Package zone.gryphon.maven.plugins.scm
Class ScmMetadataMavenPluginMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- zone.gryphon.maven.plugins.scm.ScmMetadataMavenPluginMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="metadata", defaultPhase=INITIALIZE) public class ScmMetadataMavenPluginMojo extends org.apache.maven.plugin.AbstractMojoGenerates metadata about the project's SCM, and injects it into the build context as Maven Properties for re-use by other plugins.Metadata Calculated:
revision- the current project revision (e.g. git commit SHA)revision.short- a potentially truncated version of therevisionpropertybranch- the current SCM branch (e.g.master)dirty-trueif there are any uncommitted local changes in files which are not excluded from SCM,falseotherwise (equivalent to checkinggit status --porcelain)
Remote Path Segment Properties
Additionally, properties prefixed withremote.path.segmentwill be injected for each path segment in thescm.developerConnectionconfiguration (orscm.connectionifscm.developerConnectionis not set). Each segment can be accessed by its positive 0 based index in the path, as well as a negative index based on its position relative to the end of the path (i.e. the last path segment can be accessed at index-1, the second to last at-2, etc...).
For example, the elements of the path/alpha/bravocan be accessed via the following indices:
See theSegment Index Negative Index alpha0-2bravo1-1remotePathNotationconfiguration for details about the format of theremote.path.segmentproperties.Property Prefix
Note that the name of each property is prefixed with the value of theprefixconfiguration option, meaning the properties set when using the default configuration are:scm.metadata.revisionscm.metadata.revision.shortscm.metadata.branchscm.metadata.dirtyscm.metadata.remote.path.segment[*]
- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.maven.project.MavenProjectprojectMaven project
-
Constructor Summary
Constructors Constructor Description ScmMetadataMavenPluginMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()
-