Fork me on GitHub

buildnumber:create-metadata

Full name:

org.codehaus.mojo:buildnumber-maven-plugin:3.1.0:create-metadata

Description:

This mojo discovers latest SCM revision, current timestamp, project version, and project name then write them to one or more java property files together with a set of user provided properties. It also has option to add the output file to resource classpath for jar packaging.

Attributes:

  • Requires a Maven project to be executed.
  • The goal is thread-safe and supports parallel builds.
  • Binds by default to the lifecycle phase: generate-resources.

Required Parameters

Name Type Since Description
<outputDirectory> File 1.4 Output directory
Default value is: ${project.build.directory}/generated/build-metadata.
<outputName> String 1.4 Output file name
Default value is: build.properties.

Optional Parameters

Name Type Since Description
<addOutputDirectoryToResources> boolean 1.4 Add outputDirectory to java resource so that outputName will be under runtime classpath. outputName can contain '/'
Default value is: false.
<applicationName> String 1.4 Application name
Default value is: ${project.name}.
<applicationPropertyName> String 1.4 Java property name to store the project name
Default value is: name.
<attach> boolean 1.4 Install/Deploy to Maven repository
Default value is: false.
<autoDetectOutputFormat> boolean 3.0 Enable output format detection. (Disabled per default for compatibility.)
Default value is: false.
<classifier> String 3.0 Artifact classifier name when deploying to Maven repository
Default value is: build.
<outputFiles> List<File> 1.4 Additional output files
<password> String 1.0-beta-1 The password that is used when connecting to the SCM system.
User property is: password.
<properties> Map<String,String> 1.4 Additional properties to write out
<revisionOnScmFailure> String 1.0-beta-2 Setting this value allows the build to continue even in the event of an SCM failure. The value set will be used as the revision string in the event of a failure to retrieve the revision it from the SCM.
User property is: maven.buildNumber.revisionOnScmFailure.
<revisionPropertyName> String 1.4 Java property name to store the discovered SCM revision value
Default value is: revision.
<scmDirectory> File 1.0-beta-1 Issue SCM actions at this local directory
Default value is: ${basedir}.
User property is: maven.buildNumber.scmDirectory.
<shortRevisionLength> int 1.1 Max length of a revision id (GIT only)
Default value is: 0.
User property is: maven.buildNumber.shortRevisionLength.
<skip> boolean 1.3 Whether to skip this execution.
Default value is: false.
User property is: maven.buildNumber.skip.
<timestampFormat> String 1.4 java.text.SimpleDateFormat for the discover timestamp, if not given use long integer format
User property is: maven.build.timestamp.format.
<timestampPropertyName> String 1.4 Java property name to store the discovered timestamp value
Default value is: timestamp.
<timezone> String - The timezone of the generated timestamp. If blank will default to java.util.TimeZone.getDefault()
User property is: maven.buildNumber.timestampTimeZone.
<useLastCommittedRevision> boolean 1.0-beta-2 whether to retrieve the revision for the last commit, or the last revision of the repository.
Default value is: false.
User property is: maven.buildNumber.useLastCommittedRevision.
<username> String 1.0-beta-1 The username that is used when connecting to the SCM system.
User property is: username.
<version> String 1.4 Version
Default value is: ${project.version}.
<versionPropertyName> String 1.4 Java property name to store the project version
Default value is: version.

Parameter Details

<addOutputDirectoryToResources>

Add outputDirectory to java resource so that outputName will be under runtime classpath. outputName can contain '/'
  • Type: boolean
  • Since: 1.4
  • Required: No
  • Default: false

<applicationName>

Application name
  • Type: java.lang.String
  • Since: 1.4
  • Required: No
  • Default: ${project.name}

<applicationPropertyName>

Java property name to store the project name
  • Type: java.lang.String
  • Since: 1.4
  • Required: No
  • Default: name

<attach>

Install/Deploy to Maven repository
  • Type: boolean
  • Since: 1.4
  • Required: No
  • Default: false

<autoDetectOutputFormat>

Enable output format detection. (Disabled per default for compatibility.)
  • Type: boolean
  • Since: 3.0
  • Required: No
  • Default: false

<classifier>

Artifact classifier name when deploying to Maven repository
  • Type: java.lang.String
  • Since: 3.0
  • Required: No
  • Default: build

<outputDirectory>

Output directory
  • Type: java.io.File
  • Since: 1.4
  • Required: Yes
  • Default: ${project.build.directory}/generated/build-metadata

<outputFiles>

Additional output files
  • Type: java.util.List<java.io.File>
  • Since: 1.4
  • Required: No

<outputName>

Output file name
  • Type: java.lang.String
  • Since: 1.4
  • Required: Yes
  • Default: build.properties

<password>

The password that is used when connecting to the SCM system.
  • Type: java.lang.String
  • Since: 1.0-beta-1
  • Required: No
  • User Property: password

<properties>

Additional properties to write out
  • Type: java.util.Map<java.lang.String, java.lang.String>
  • Since: 1.4
  • Required: No

<revisionOnScmFailure>

Setting this value allows the build to continue even in the event of an SCM failure. The value set will be used as the revision string in the event of a failure to retrieve the revision it from the SCM.
  • Type: java.lang.String
  • Since: 1.0-beta-2
  • Required: No
  • User Property: maven.buildNumber.revisionOnScmFailure

<revisionPropertyName>

Java property name to store the discovered SCM revision value
  • Type: java.lang.String
  • Since: 1.4
  • Required: No
  • Default: revision

<scmDirectory>

Issue SCM actions at this local directory
  • Type: java.io.File
  • Since: 1.0-beta-1
  • Required: No
  • User Property: maven.buildNumber.scmDirectory
  • Default: ${basedir}

<shortRevisionLength>

Max length of a revision id (GIT only)
  • Type: int
  • Since: 1.1
  • Required: No
  • User Property: maven.buildNumber.shortRevisionLength
  • Default: 0

<skip>

Whether to skip this execution.
  • Type: boolean
  • Since: 1.3
  • Required: No
  • User Property: maven.buildNumber.skip
  • Default: false

<timestampFormat>

java.text.SimpleDateFormat for the discover timestamp, if not given use long integer format
  • Type: java.lang.String
  • Since: 1.4
  • Required: No
  • User Property: maven.build.timestamp.format

<timestampPropertyName>

Java property name to store the discovered timestamp value
  • Type: java.lang.String
  • Since: 1.4
  • Required: No
  • Default: timestamp

<timezone>

The timezone of the generated timestamp. If blank will default to java.util.TimeZone.getDefault()
  • Type: java.lang.String
  • Required: No
  • User Property: maven.buildNumber.timestampTimeZone

<useLastCommittedRevision>

whether to retrieve the revision for the last commit, or the last revision of the repository.
  • Type: boolean
  • Since: 1.0-beta-2
  • Required: No
  • User Property: maven.buildNumber.useLastCommittedRevision
  • Default: false

<username>

The username that is used when connecting to the SCM system.
  • Type: java.lang.String
  • Since: 1.0-beta-1
  • Required: No
  • User Property: username

<version>

Version
  • Type: java.lang.String
  • Since: 1.4
  • Required: No
  • Default: ${project.version}

<versionPropertyName>

Java property name to store the project version
  • Type: java.lang.String
  • Since: 1.4
  • Required: No
  • Default: version