Class CommonsDistributionStagingMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.commons.release.plugin.mojos.CommonsDistributionStagingMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
@Mojo(name="stage-distributions",
defaultPhase=DEPLOY,
threadSafe=true,
aggregator=true)
public final class CommonsDistributionStagingMojo
extends org.apache.maven.plugin.AbstractMojo
Checks out the dev distribution location, copies the distributions into that directory
structure under the
target/commons-release-plugin/scm directory, and commits the
distributions back to SVN. Includes the built and zipped site as well as the RELEASE-NOTES.txt file.- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FileTheFilerepresenting the root directory of the working project.private StringThe RC version of the release.private StringThe release version of the artifact to be built.private FileThe location to which to check out the dist Subversion repository under our working directory, which was given above.private FileA subdirectory of the dist directory into which we are going to stage the release candidate.private StringThe ID of the server (specified in settings.xml) which should be used for dist authentication.private StringThe URL of the Subversion repository to which we wish the artifacts to be staged.private BooleanA boolean that determines whether or not we actually commit the files up to the Subversion repository.private static final StringThe name of the file generated from the HEADER.vm Velocity template to be checked into the dist SVN repo.private BooleanA parameter to generally avoid running unless it is specifically turned on by the consuming module.private StringThe password associated withusername.private org.apache.maven.project.MavenProjectTheMavenProjectobject is essentially the context of the Maven build at a given time.private static final StringThe name of the file generated from the README.vm Velocity template to be checked into the dist SVN repo.private FileThe location of the RELEASE-NOTES.txt file such that multi-module builds can configure it.private org.apache.maven.settings.SettingsMavenSettings.private org.apache.maven.settings.crypto.SettingsDecrypterMavenSettingsDecryptercomponent.private static final StringThe name of the signature validation shell script to be checked into the dist SVN repo.private FileThe location to which the site gets built when runningmvn site.private StringThe username for the distribution Subversion repository.private FileThe main working directory for the plugin, namelytarget/commons-release-plugin, but that assumes that we're using the default Maven${project.build.directory}.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBuilds upREADME.htmlandHEADER.htmlthat reside in the following directory structure: distRoot binaries/HEADER.html (symlink) binaries/README.html (symlink) source/HEADER.html (symlink) source/README.html (symlink) HEADER.html README.htmlcopyDistributionsIntoScmDirectoryStructureAndAddToSvn(File copiedReleaseNotes, org.apache.maven.scm.provider.ScmProvider provider, org.apache.maven.scm.repository.ScmRepository repository) Copies the list of files at the root of theworkingDirectoryinto the directory structure of the distribution staging repository.copyHeaderAndReadmeToSubdirectories(File headerFile, File readmeFile) CopiesREADME.htmlandHEADER.htmlto the source and binaries directories.private FileCopies the configured release notes file intodistRcVersionDirectory.private FileCopies oursignature-validator.shscript into${basedir}/target/commons-release-plugin/scm/signature-validator.sh.Copies${basedir}/target/siteto${basedir}/target/commons-release-plugin/scm/site.voidexecute()private voidlistNotHiddenFilesAndDirectories(File directory, List<File> files) Lists all directories and files in a flat list.protected voidsetBaseDir(File baseDir) Sets thebaseDirfield for use in unit tests.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
README_FILE_NAME
The name of the file generated from the README.vm Velocity template to be checked into the dist SVN repo.- See Also:
-
HEADER_FILE_NAME
The name of the file generated from the HEADER.vm Velocity template to be checked into the dist SVN repo.- See Also:
-
SIGNATURE_VALIDATOR_NAME
The name of the signature validation shell script to be checked into the dist SVN repo.- See Also:
-
project
@Parameter(defaultValue="${project}", required=true) private org.apache.maven.project.MavenProject projectTheMavenProjectobject is essentially the context of the Maven build at a given time. -
baseDir
-
siteDirectory
@Parameter(defaultValue="${project.build.directory}/site", property="commons.siteOutputDirectory") private File siteDirectoryThe location to which the site gets built when runningmvn site. -
workingDirectory
@Parameter(defaultValue="${project.build.directory}/commons-release-plugin", property="commons.outputDirectory") private File workingDirectoryThe main working directory for the plugin, namelytarget/commons-release-plugin, but that assumes that we're using the default Maven${project.build.directory}. -
distCheckoutDirectory
@Parameter(defaultValue="${project.build.directory}/commons-release-plugin/scm", property="commons.distCheckoutDirectory") private File distCheckoutDirectoryThe location to which to check out the dist Subversion repository under our working directory, which was given above. -
releaseNotesFile
@Parameter(defaultValue="${basedir}/RELEASE-NOTES.txt", property="commons.releaseNotesLocation") private File releaseNotesFileThe location of the RELEASE-NOTES.txt file such that multi-module builds can configure it. -
dryRun
A boolean that determines whether or not we actually commit the files up to the Subversion repository. If this is set totrue, we do all but make the commits. We do check out the repository in question, though. -
distSvnStagingUrl
The URL of the Subversion repository to which we wish the artifacts to be staged. Typically this would need to be of the form:scm:svn:https://dist.apache.org/repos/dist/dev/commons/foo/version-RC#. Note that the prefix to the substringhttpsis a requirement. -
isDistModule
@Parameter(defaultValue="false", property="commons.release.isDistModule") private Boolean isDistModuleA parameter to generally avoid running unless it is specifically turned on by the consuming module. -
commonsReleaseVersion
The release version of the artifact to be built. -
commonsRcVersion
The RC version of the release. For example, the first release candidate would be "RC1". -
distServer
-
username
-
password
-
settings
@Parameter(defaultValue="${settings}", readonly=true, required=true) private org.apache.maven.settings.Settings settingsMavenSettings. -
settingsDecrypter
MavenSettingsDecryptercomponent. -
distRcVersionDirectory
A subdirectory of the dist directory into which we are going to stage the release candidate. We build this up in theexecute()method. For example, the directory should look likehttps://dist.apache.org/repos/dist/dev/commons/text/1.4-RC1.
-
-
Constructor Details
-
CommonsDistributionStagingMojo
public CommonsDistributionStagingMojo()Constructs a new instance.
-
-
Method Details
-
buildReadmeAndHeaderHtmlFiles
private List<File> buildReadmeAndHeaderHtmlFiles() throws org.apache.maven.plugin.MojoExecutionExceptionBuilds upREADME.htmlandHEADER.htmlthat reside in the following directory structure:- distRoot
- binaries/HEADER.html (symlink)
- binaries/README.html (symlink)
- source/HEADER.html (symlink)
- source/README.html (symlink)
- HEADER.html
- README.html
- Returns:
- The
Listof created files above - Throws:
org.apache.maven.plugin.MojoExecutionException- Thrown if anIOExceptionoccurs while creating these files.
- distRoot
-
copyDistributionsIntoScmDirectoryStructureAndAddToSvn
private List<File> copyDistributionsIntoScmDirectoryStructureAndAddToSvn(File copiedReleaseNotes, org.apache.maven.scm.provider.ScmProvider provider, org.apache.maven.scm.repository.ScmRepository repository) throws org.apache.maven.plugin.MojoExecutionException Copies the list of files at the root of theworkingDirectoryinto the directory structure of the distribution staging repository. Specifically:- root:
- site
- site.zip
- RELEASE-NOTES.txt
- source:
- -src artifacts....
- binaries:
- -bin artifacts....
- Parameters:
copiedReleaseNotes- is the RELEASE-NOTES.txt file that exists in thetarget/commons-release-plugin/scmdirectory.provider- is theScmProviderthat we will use for adding the files we wish to commit.repository- is theScmRepositorythat we will use for adding the files that we wish to commit.- Returns:
- A
ListofFileobjects in the directory for the purpose of adding them to the MavenScmFileSet. - Throws:
org.apache.maven.plugin.MojoExecutionException- Thrown if anIOExceptionoccurs.
- root:
-
copyHeaderAndReadmeToSubdirectories
private List<File> copyHeaderAndReadmeToSubdirectories(File headerFile, File readmeFile) throws org.apache.maven.plugin.MojoExecutionException CopiesREADME.htmlandHEADER.htmlto the source and binaries directories.- Parameters:
headerFile- The originally createdHEADER.htmlfile.readmeFile- The originally createdREADME.htmlfile.- Returns:
- A
Listof created files. - Throws:
org.apache.maven.plugin.MojoExecutionException- Thrown ifSharedFunctions.copyFile(Log, File, File)fails.
-
copyReleaseNotesToWorkingDirectory
private File copyReleaseNotesToWorkingDirectory() throws org.apache.maven.plugin.MojoExecutionExceptionCopies the configured release notes file intodistRcVersionDirectory.- Returns:
- The copied release notes file in
distRcVersionDirectory, for inclusion in the SCM change set in the methodcopyDistributionsIntoScmDirectoryStructureAndAddToSvn(File, ScmProvider, ScmRepository). - Throws:
org.apache.maven.plugin.MojoExecutionException- Thrown if anIOExceptionoccurs while copying the file.
-
copySignatureValidatorScriptToScmDirectory
private File copySignatureValidatorScriptToScmDirectory() throws org.apache.maven.plugin.MojoExecutionExceptionCopies oursignature-validator.shscript into${basedir}/target/commons-release-plugin/scm/signature-validator.sh.- Returns:
- The
Filefor the signature-validator.sh - Throws:
org.apache.maven.plugin.MojoExecutionException- Thrown if an error occurs while copying the resource.
-
copySiteToScmDirectory
Copies${basedir}/target/siteto${basedir}/target/commons-release-plugin/scm/site. -
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
listNotHiddenFilesAndDirectories
-
setBaseDir
-