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.AbstractMojoThis class checks out the dev distribution location, copies the distributions into that directory structure under thetarget/commons-release-plugin/scmdirectory. 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
Fields Modifier and Type Field Description private FilebaseDirTheFilethat contains a file to the root directory of the working project.private StringcommonsRcVersionThe RC version of the release.private StringcommonsReleaseVersionThe release version of the artifact to be built.private FiledistCheckoutDirectoryThe location to which to check out the dist subversion repository under our working directory, which was given above.private FiledistRcVersionDirectoryA subdirectory of the dist directory into which we are going to stage the release candidate.private StringdistServerThe ID of the server (specified in settings.xml) which should be used for dist authentication.private StringdistSvnStagingUrlThe url of the subversion repository to which we wish the artifacts to be staged.private BooleandryRunA boolean that determines whether or not we actually commit the files up to the subversion repository.private static StringHEADER_FILE_NAMEThe name of file generated from the HEADER.vm velocity template to be checked into the dist svn repo.private BooleanisDistModuleA parameter to generally avoid running unless it is specifically turned on by the consuming module.private StringpasswordThe password associated withusername.private org.apache.maven.project.MavenProjectprojectTheMavenProjectobject is essentially the context of the maven build at a given time.private static StringREADME_FILE_NAMEThe name of file generated from the README.vm velocity template to be checked into the dist svn repo.private FilereleaseNotesFileThe location of the RELEASE-NOTES.txt file such that multi-module builds can configure it.private org.apache.maven.settings.SettingssettingsMavenSettings.private org.apache.maven.settings.crypto.SettingsDecryptersettingsDecrypterMavenSettingsDecryptercomponent.private static StringSIGNATURE_VALIDATOR_NAMEThe name of the signature validation shell script to be checked into the dist svn repo.private FilesiteDirectoryThe location to which the site gets built during runningmvn site.private StringusernameThe username for the distribution subversion repository.private FileworkingDirectoryThe main working directory for the plugin, namelytarget/commons-release-plugin, but that assumes that we're using the default maven${project.build.directory}.
-
Constructor Summary
Constructors Constructor Description CommonsDistributionStagingMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private List<File>buildReadmeAndHeaderHtmlFiles()Builds upREADME.htmlandHEADER.htmlthat reside in following.private List<File>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.private List<File>copyHeaderAndReadmeToSubdirectories(File headerFile, File readmeFile)CopiesREADME.htmlandHEADER.htmlto the source and binaries directories.private FilecopyReleaseNotesToWorkingDirectory()A utility method that takes theRELEASE-NOTES.txtfile from the base directory of the project and copies it intoworkingDirectory.private FilecopySignatureValidatorScriptToScmDirectory()Copies oursignature-validator.shscript into${basedir}/target/commons-release-plugin/scm/signature-validator.sh.private List<File>copySiteToScmDirectory()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.
-
-
-
Field Detail
-
README_FILE_NAME
private static final String README_FILE_NAME
The name of file generated from the README.vm velocity template to be checked into the dist svn repo.- See Also:
- Constant Field Values
-
HEADER_FILE_NAME
private static final String HEADER_FILE_NAME
The name of file generated from the HEADER.vm velocity template to be checked into the dist svn repo.- See Also:
- Constant Field Values
-
SIGNATURE_VALIDATOR_NAME
private static final String SIGNATURE_VALIDATOR_NAME
The name of the signature validation shell script to be checked into the dist svn repo.- See Also:
- Constant Field Values
-
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
@Parameter(defaultValue="${basedir}") private File baseDirTheFilethat 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
@Parameter(property="commons.release.dryRun", defaultValue="false") private Boolean dryRunA 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
@Parameter(defaultValue="", property="commons.distSvnStagingUrl") private String distSvnStagingUrlThe 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
@Parameter(property="commons.release.version") private String commonsReleaseVersion
The release version of the artifact to be built.
-
commonsRcVersion
@Parameter(property="commons.rc.version") private String commonsRcVersion
The RC version of the release. For example the first voted on candidate would be "RC1".
-
distServer
@Parameter(property="commons.distServer") private String distServer
-
username
@Parameter(property="user.name") private String username
The username for the distribution subversion repository. This is typically your Apache id.
-
password
@Parameter(property="user.password") private String password
The password associated withusername.
-
settings
@Parameter(defaultValue="${settings}", readonly=true, required=true) private org.apache.maven.settings.Settings settingsMavenSettings.
-
settingsDecrypter
@Component private org.apache.maven.settings.crypto.SettingsDecrypter settingsDecrypter
MavenSettingsDecryptercomponent.
-
distRcVersionDirectory
private File 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 Detail
-
CommonsDistributionStagingMojo
public CommonsDistributionStagingMojo()
-
-
Method Detail
-
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
private void listNotHiddenFilesAndDirectories(File directory, List<File> files)
Lists all directories and files to a flat list.
-
copyReleaseNotesToWorkingDirectory
private File copyReleaseNotesToWorkingDirectory() throws org.apache.maven.plugin.MojoExecutionException
A 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.MojoExecutionException
Copies 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
private List<File> copySiteToScmDirectory() throws org.apache.maven.plugin.MojoExecutionException
Copies${basedir}/target/siteto${basedir}/target/commons-release-plugin/scm/site.
-
buildReadmeAndHeaderHtmlFiles
private List<File> buildReadmeAndHeaderHtmlFiles() throws org.apache.maven.plugin.MojoExecutionException
Builds 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
protected void setBaseDir(File baseDir)
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.
-
-