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 class CommonsDistributionStagingMojo
extends org.apache.maven.plugin.AbstractMojo
This class checks out the dev distribution location, copies the distributions into that directory
structure under the
target/commons-release-plugin/scm directory. Then commits the
distributions back up to SVN. Also, we include the built and zipped site as well as the RELEASE-NOTES.txt.- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FileTheFilethat contains a file to 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 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 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 during 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 following.copyDistributionsIntoScmDirectoryStructureAndAddToSvn(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 FileA utility method that takes theRELEASE-NOTES.txtfile from the base directory of the project and copies it intoworkingDirectory.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 to a flat list.protected voidsetBaseDir(File baseDir) This method is the setter for thebaseDirfield, specifically for the usage in the unit tests.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
README_FILE_NAME
The name of file generated from the README.vm velocity template to be checked into the dist svn repo.- See Also:
-
HEADER_FILE_NAME
The name of 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
TheFilethat contains a file to the root directory of the working project. Typically this directory is where thepom.xmlresides. -
siteDirectory
@Parameter(defaultValue="${project.build.directory}/site", property="commons.siteOutputDirectory") private File siteDirectoryThe location to which the site gets built during 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 checkout 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 voted on candidate would be "RC1". -
distServer
-
username
The username for the distribution subversion repository. This is typically your Apache id. -
password
The password associated withusername. -
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. And, for example, the directory should look likehttps://dist.apache.org/repos/dist/dev/commons/text/1.4-RC1.
-
-
Constructor Details
-
CommonsDistributionStagingMojo
public CommonsDistributionStagingMojo()
-
-
Method Details
-
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
Lists all directories and files to a flat list. -
copyReleaseNotesToWorkingDirectory
private File copyReleaseNotesToWorkingDirectory() throws org.apache.maven.plugin.MojoExecutionExceptionA utility method that takes theRELEASE-NOTES.txtfile from the base directory of the project and copies it intoworkingDirectory.- Returns:
- the RELEASE-NOTES.txt file that exists in the
target/commons-release-notes/scmdirectory for the purpose of adding it to the scm change set in the methodcopyDistributionsIntoScmDirectoryStructureAndAddToSvn(File, ScmProvider, ScmRepository). - Throws:
org.apache.maven.plugin.MojoExecutionException- if anIOExceptionoccurs as a wrapper so that maven can properly handle the exception.
-
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
ListofFile's in the directory for the purpose of adding them to the mavenScmFileSet. - Throws:
org.apache.maven.plugin.MojoExecutionException- if anIOExceptionoccurs so that Maven can handle it properly.
- root:
-
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- if an error occurs while the resource is being copied
-
copySiteToScmDirectory
Copies${basedir}/target/siteto${basedir}/target/commons-release-plugin/scm/site. -
buildReadmeAndHeaderHtmlFiles
private List<File> buildReadmeAndHeaderHtmlFiles() throws org.apache.maven.plugin.MojoExecutionExceptionBuilds upREADME.htmlandHEADER.htmlthat reside in following.- 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- if anIOExceptionoccurs in the creation of these files fails.
- distRoot
-
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- if theSharedFunctions.copyFile(Log, File, File)fails.
-
setBaseDir
This method is the setter for thebaseDirfield, specifically for the usage in the unit tests.- Parameters:
baseDir- is theFileto be used as the project's root directory when this mojo is invoked.
-