Plugin Documentation

Goals available for this plugin:

Goal Description
scm-metadata:help Display help information on scm-metadata-maven-plugin.
Call mvn scm-metadata:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.
scm-metadata:metadata 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 the revision property
  • branch - 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 checking git status --porcelain)

Remote Path Segment Properties

Additionally, properties prefixed with remote.path.segment will be injected for each path segment in the scm.developerConnection configuration (or scm.connection if scm.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
See the remotePathNotation configuration for details about the format of the remote.path.segment properties.

Property Prefix

Note that the name of each property is prefixed with the value of the prefix 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[*]

System Requirements

The following specifies the minimum requirements to run this Maven plugin:

Maven 3.3.3
JDK 1.7
Memory No minimum requirement.
Disk Space No minimum requirement.

Usage

You should specify the version in your project's plugin configuration:

<project>
  ...
  <build>
    <!-- To define the plugin version in your parent POM -->
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>zone.gryphon.maven.plugins</groupId>
          <artifactId>scm-metadata-maven-plugin</artifactId>
          <version>1.8</version>
        </plugin>
        ...
      </plugins>
    </pluginManagement>
    <!-- To use the plugin goals in your POM or parent POM -->
    <plugins>
      <plugin>
        <groupId>zone.gryphon.maven.plugins</groupId>
        <artifactId>scm-metadata-maven-plugin</artifactId>
        <version>1.8</version>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>

For more information, see "Guide to Configuring Plug-ins"