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.AbstractMojo
Generates 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 therevision
propertybranch
- the current SCM branch (e.g.master
)dirty
-true
if there are any uncommitted local changes in files which are not excluded from SCM,false
otherwise (equivalent to checkinggit status --porcelain
)
Remote Path Segment Properties
Additionally, properties prefixed withremote.path.segment
will be injected for each path segment in thescm.developerConnection
configuration (orscm.connection
ifscm.developerConnection
is 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/bravo
can be accessed via the following indices:Segment Index Negative Index alpha
0
-2
bravo
1
-1
remotePathNotation
configuration for details about the format of theremote.path.segment
properties.Property Prefix
Note that the name of each property is prefixed with the value of theprefix
configuration option, meaning the properties set when using the default configuration are:scm.metadata.revision
scm.metadata.revision.short
scm.metadata.branch
scm.metadata.dirty
scm.metadata.remote.path.segment[*]
- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.maven.project.MavenProject
project
Maven project
-
Constructor Summary
Constructors Constructor Description ScmMetadataMavenPluginMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute()
-