@Mojo(name="stage-distributions",
defaultPhase=DEPLOY,
threadSafe=true,
aggregator=true)
public class CommonsDistributionStagingMojo
extends org.apache.maven.plugin.AbstractMojo
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.Modifier and Type | Field and Description |
---|---|
private File |
baseDir
The
File that contains a file to the root directory of the working project. |
private String |
commonsRcVersion
The RC version of the release.
|
private String |
commonsReleaseVersion
The release version of the artifact to be built.
|
private File |
distCheckoutDirectory
The location to which to checkout the dist subversion repository under our working directory, which
was given above.
|
private File |
distRcVersionDirectory
A subdirectory of the dist directory into which we are going to stage the release candidate.
|
private String |
distServer
The ID of the server (specified in settings.xml) which should be used for dist authentication.
|
private String |
distSvnStagingUrl
The url of the subversion repository to which we wish the artifacts to be staged.
|
private Boolean |
dryRun
A boolean that determines whether or not we actually commit the files up to the subversion repository.
|
private static String |
HEADER_FILE_NAME
The name of file generated from the HEADER.vm velocity template to be checked into the dist svn repo.
|
private Boolean |
isDistModule
A parameter to generally avoid running unless it is specifically turned on by the consuming module.
|
private String |
password
The password associated with
username . |
private org.apache.maven.project.MavenProject |
project
The
MavenProject object is essentially the context of the maven build at
a given time. |
private static String |
README_FILE_NAME
The name of file generated from the README.vm velocity template to be checked into the dist svn repo.
|
private File |
releaseNotesFile
The location of the RELEASE-NOTES.txt file such that multi-module builds can configure it.
|
private org.apache.maven.settings.Settings |
settings
Maven
Settings . |
private org.apache.maven.settings.crypto.SettingsDecrypter |
settingsDecrypter
Maven
SettingsDecrypter component. |
private static String |
SIGNATURE_VALIDATOR_NAME
The name of the signature validation shell script to be checked into the dist svn repo.
|
private File |
siteDirectory
The location to which the site gets built during running
mvn site . |
private String |
username
The username for the distribution subversion repository.
|
private File |
workingDirectory
The main working directory for the plugin, namely
target/commons-release-plugin , but
that assumes that we're using the default maven ${project.build.directory} . |
Constructor and Description |
---|
CommonsDistributionStagingMojo() |
Modifier and Type | Method and Description |
---|---|
private List<File> |
buildReadmeAndHeaderHtmlFiles()
Builds up
README.html and HEADER.html that 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 the
workingDirectory into
the directory structure of the distribution staging repository. |
private List<File> |
copyHeaderAndReadmeToSubdirectories(File headerFile,
File readmeFile)
Copies
README.html and HEADER.html to the source and binaries
directories. |
private File |
copyReleaseNotesToWorkingDirectory()
A utility method that takes the
RELEASE-NOTES.txt file from the base directory of the
project and copies it into workingDirectory . |
private File |
copySignatureValidatorScriptToScmDirectory()
Copies our
signature-validator.sh script into
${basedir}/target/commons-release-plugin/scm/signature-validator.sh . |
private List<File> |
copySiteToScmDirectory()
Copies
${basedir}/target/site to ${basedir}/target/commons-release-plugin/scm/site . |
void |
execute() |
private void |
listNotHiddenFilesAndDirectories(File directory,
List<File> files)
Lists all directories and files to a flat list.
|
protected void |
setBaseDir(File baseDir)
This method is the setter for the
baseDir field, specifically
for the usage in the unit tests. |
private static final String README_FILE_NAME
private static final String HEADER_FILE_NAME
private static final String SIGNATURE_VALIDATOR_NAME
@Parameter(defaultValue="${project}", required=true) private org.apache.maven.project.MavenProject project
MavenProject
object is essentially the context of the maven build at
a given time.@Parameter(defaultValue="${basedir}") private File baseDir
File
that contains a file to the root directory of the working project. Typically
this directory is where the pom.xml
resides.@Parameter(defaultValue="${project.build.directory}/site", property="commons.siteOutputDirectory") private File siteDirectory
mvn site
.@Parameter(defaultValue="${project.build.directory}/commons-release-plugin", property="commons.outputDirectory") private File workingDirectory
target/commons-release-plugin
, but
that assumes that we're using the default maven ${project.build.directory}
.@Parameter(defaultValue="${project.build.directory}/commons-release-plugin/scm", property="commons.distCheckoutDirectory") private File distCheckoutDirectory
@Parameter(defaultValue="${basedir}/RELEASE-NOTES.txt", property="commons.releaseNotesLocation") private File releaseNotesFile
@Parameter(property="commons.release.dryRun", defaultValue="false") private Boolean dryRun
true
, we do all but make the commits. We do checkout the repository in question
though.@Parameter(defaultValue="", property="commons.distSvnStagingUrl") private String distSvnStagingUrl
scm:svn:https://dist.apache.org/repos/dist/dev/commons/foo/version-RC#
. Note. that
the prefix to the substring https
is a requirement.@Parameter(defaultValue="false", property="commons.release.isDistModule") private Boolean isDistModule
@Parameter(property="commons.release.version") private String commonsReleaseVersion
@Parameter(property="commons.rc.version") private String commonsRcVersion
@Parameter(property="commons.distServer") private String distServer
@Parameter(property="user.name") private String username
@Parameter(property="user.password") private String password
username
.@Parameter(defaultValue="${settings}", readonly=true, required=true) private org.apache.maven.settings.Settings settings
Settings
.@Component private org.apache.maven.settings.crypto.SettingsDecrypter settingsDecrypter
SettingsDecrypter
component.private File distRcVersionDirectory
execute()
method. And, for example,
the directory should look like https://https://dist.apache.org/repos/dist/dev/commons/text/1.4-RC1
.public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
private void listNotHiddenFilesAndDirectories(File directory, List<File> files)
private File copyReleaseNotesToWorkingDirectory() throws org.apache.maven.plugin.MojoExecutionException
RELEASE-NOTES.txt
file from the base directory of the
project and copies it into workingDirectory
.target/commons-release-notes/scm
directory for the purpose of adding it to the scm change set in the method
copyDistributionsIntoScmDirectoryStructureAndAddToSvn(File,
ScmProvider, ScmRepository)
.org.apache.maven.plugin.MojoExecutionException
- if an IOException
occurs as a wrapper so that maven
can properly handle the exception.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
workingDirectory
into
the directory structure of the distribution staging repository. Specifically:
copiedReleaseNotes
- is the RELEASE-NOTES.txt file that exists in the
target/commons-release-plugin/scm
directory.provider
- is the ScmProvider
that we will use for adding the files we wish to commit.repository
- is the ScmRepository
that we will use for adding the files that we wish to commit.List
of File
's in the directory for the purpose of adding them to the maven
ScmFileSet
.org.apache.maven.plugin.MojoExecutionException
- if an IOException
occurs so that Maven can handle it properly.private File copySignatureValidatorScriptToScmDirectory() throws org.apache.maven.plugin.MojoExecutionException
signature-validator.sh
script into
${basedir}/target/commons-release-plugin/scm/signature-validator.sh
.File
for the signature-validator.shorg.apache.maven.plugin.MojoExecutionException
- if an error occurs while the resource is being copiedprivate List<File> copySiteToScmDirectory() throws org.apache.maven.plugin.MojoExecutionException
${basedir}/target/site
to ${basedir}/target/commons-release-plugin/scm/site
.private List<File> buildReadmeAndHeaderHtmlFiles() throws org.apache.maven.plugin.MojoExecutionException
README.html
and HEADER.html
that reside in following.
List
of created files aboveorg.apache.maven.plugin.MojoExecutionException
- if an IOException
occurs in the creation of these
files fails.private List<File> copyHeaderAndReadmeToSubdirectories(File headerFile, File readmeFile) throws org.apache.maven.plugin.MojoExecutionException
README.html
and HEADER.html
to the source and binaries
directories.headerFile
- The originally created HEADER.html
file.readmeFile
- The originally created README.html
file.List
of created files.org.apache.maven.plugin.MojoExecutionException
- if the SharedFunctions.copyFile(Log, File, File)
fails.Copyright © 2018–2022 The Apache Software Foundation. All rights reserved.