Class CommonsDistributionDetachmentMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.commons.release.plugin.mojos.CommonsDistributionDetachmentMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="detach-distributions", defaultPhase=VERIFY, threadSafe=true, aggregator=true) public class CommonsDistributionDetachmentMojo extends org.apache.maven.plugin.AbstractMojoThe purpose of this Maven mojo is to detach the artifacts generated by the maven-assembly-plugin, which for the Apache Commons Project do not get uploaded to Nexus, and putting those artifacts in the dev distribution location for Apache projects.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private static Set<String>ARTIFACT_TYPES_TO_DETACHA list of "artifact types" in the Maven vernacular, to be detached from the deployment.private org.apache.commons.collections4.properties.SortedPropertiesartifactSha512sASortedPropertiesofArtifact→Stringcontaining the sha512 signatures for the individual artifacts, where theArtifactis represented as:groupId:artifactId:version:type=sha512.private List<org.apache.maven.artifact.Artifact>detachedArtifactsThis list is supposed to hold the Maven references to the aforementioned artifacts so that we can upload them to svn after they've been detached from the Maven deployment.private StringdistSvnStagingUrlThe subversion staging url to which we upload all of our staged artifacts.private BooleanisDistModuleA parameter to generally avoid running unless it is specifically turned on by the consuming module.private org.apache.maven.project.MavenProjectprojectThe maven project context injection so that we can get a hold of the variables at hand.private FileworkingDirectoryThe working directory intargetthat we use as a sandbox for the plugin.
-
Constructor Summary
Constructors Constructor Description CommonsDistributionDetachmentMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcopyRemovedArtifactsToWorkingDirectory()A helper method to copy the newly detached artifacts totarget/commons-release-pluginso that theCommonsDistributionStagingMojocan find the artifacts later.voidexecute()private StringgetArtifactKey(org.apache.maven.artifact.Artifact artifact)Generates the unique artifact key for storage in our sha512 map.private StringgetSha512FilePath(File directory, File file)A helper method to create a file path for thesha512signature file from a given file.private voidhashArtifacts()A helper method that creates sha512 signature files for our detached artifacts in thetarget/commons-release-plugindirectory for the purpose of being uploaded by theCommonsDistributionStagingMojo.private voidputAttachedArtifactInSha512Map(org.apache.maven.artifact.Artifact artifact)Takes an attached artifact and puts the signature in the map.private voidwriteAllArtifactsInSha512PropertiesFile()Writes to ./target/commons-release-plugin/sha512.properties the artifact sha512's.
-
-
-
Field Detail
-
ARTIFACT_TYPES_TO_DETACH
private static final Set<String> ARTIFACT_TYPES_TO_DETACH
A list of "artifact types" in the Maven vernacular, to be detached from the deployment. For the time being we want all artifacts generated by the maven-assembly-plugin to be detached from the deployment, namely *-src.zip, *-src.tar.gz, *-bin.zip, *-bin.tar.gz, and the corresponding .asc pgp signatures.
-
detachedArtifacts
private final List<org.apache.maven.artifact.Artifact> detachedArtifacts
This list is supposed to hold the Maven references to the aforementioned artifacts so that we can upload them to svn after they've been detached from the Maven deployment.
-
artifactSha512s
private final org.apache.commons.collections4.properties.SortedProperties artifactSha512s
ASortedPropertiesofArtifact→Stringcontaining the sha512 signatures for the individual artifacts, where theArtifactis represented as:groupId:artifactId:version:type=sha512.
-
project
@Parameter(defaultValue="${project}", required=true) private org.apache.maven.project.MavenProject projectThe maven project context injection so that we can get a hold of the variables at hand.
-
workingDirectory
@Parameter(defaultValue="${project.build.directory}/commons-release-plugin", property="commons.outputDirectory") private File workingDirectoryThe working directory intargetthat we use as a sandbox for the plugin.
-
distSvnStagingUrl
@Parameter(defaultValue="", property="commons.distSvnStagingUrl") private String distSvnStagingUrlThe subversion staging url to which we upload all of our staged artifacts.
-
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.
-
-
Constructor Detail
-
CommonsDistributionDetachmentMojo
public CommonsDistributionDetachmentMojo()
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
putAttachedArtifactInSha512Map
private void putAttachedArtifactInSha512Map(org.apache.maven.artifact.Artifact artifact) throws org.apache.maven.plugin.MojoExecutionException
Takes an attached artifact and puts the signature in the map.- Parameters:
artifact- is a MavenArtifacttaken from the project at start time of mojo.- Throws:
org.apache.maven.plugin.MojoExecutionException- if anIOExceptionoccurs when getting the sha512 of the artifact.
-
writeAllArtifactsInSha512PropertiesFile
private void writeAllArtifactsInSha512PropertiesFile() throws org.apache.maven.plugin.MojoExecutionException
Writes to ./target/commons-release-plugin/sha512.properties the artifact sha512's.- Throws:
org.apache.maven.plugin.MojoExecutionException- if we can't write the file due to anIOException.
-
copyRemovedArtifactsToWorkingDirectory
private void copyRemovedArtifactsToWorkingDirectory() throws org.apache.maven.plugin.MojoExecutionException
A helper method to copy the newly detached artifacts totarget/commons-release-pluginso that theCommonsDistributionStagingMojocan find the artifacts later.- Throws:
org.apache.maven.plugin.MojoExecutionException- if some form of anIOExceptionoccurs, we want it properly wrapped so that Maven can handle it.
-
hashArtifacts
private void hashArtifacts() throws org.apache.maven.plugin.MojoExecutionException
A helper method that creates sha512 signature files for our detached artifacts in thetarget/commons-release-plugindirectory for the purpose of being uploaded by theCommonsDistributionStagingMojo.- Throws:
org.apache.maven.plugin.MojoExecutionException- if some form of anIOExceptionoccurs, we want it properly wrapped so that Maven can handle it.
-
getSha512FilePath
private String getSha512FilePath(File directory, File file)
A helper method to create a file path for thesha512signature file from a given file.
-
getArtifactKey
private String getArtifactKey(org.apache.maven.artifact.Artifact artifact)
Generates the unique artifact key for storage in our sha512 map. For example, commons-test-1.4-src.tar.gz should have its name as the key.- Parameters:
artifact- theArtifactthat we wish to generate a key for.- Returns:
- the generated key
-
-