Fork me on GitHub

buildnumber:create-metadata

Full name:

org.codehaus.mojo:buildnumber-maven-plugin:3.2.1: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: ${project.build.directory}/generated/build-metadata
<outputName> String 1.4 Output file name
Default: 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: false
<applicationName> String 1.4 Application name
Default: ${project.name}
<applicationPropertyName> String 1.4 Java property name to store the project name
Default: name
<attach> boolean 1.4 Install/Deploy to Maven repository
Default: false
<autoDetectOutputFormat> boolean 3.0 Enable output format detection. (Disabled per default for compatibility.)
Default: false
<classifier> String 3.0 Artifact classifier name when deploying to Maven repository
Default: build
<ignoreEmptyScmUrl> boolean 3.2.1 Ignore error when scm url from pom is empty and replace by scm:scmProvider scmProvider
Default: false
User Property: maven.buildNumber.ignoreEmptyScmUrl
<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: 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: maven.buildNumber.revisionOnScmFailure
<revisionPropertyName> String 1.4 Java property name to store the discovered SCM revision value
Default: revision
<scmDirectory> File 1.0-beta-1 Issue SCM actions at this local directory
Default: ${basedir}
User Property: maven.buildNumber.scmDirectory
<scmProvider> String 3.2.1 When scm url is empty, scm provider is needed ignoreEmptyScmUrl
Default: git
User Property: maven.buildNumber.scmProvider
<shortRevisionLength> int 1.1 Max length of a revision id (GIT only)
Default: 0
User Property: maven.buildNumber.shortRevisionLength
<skip> boolean 1.3 Whether to skip this execution.
Default: false
User Property: maven.buildNumber.skip
<timestampFormat> String 1.4 java.text.SimpleDateFormat for the discover timestamp, if not given use long integer format
User Property: maven.build.timestamp.format
<timestampPropertyName> String 1.4 Java property name to store the discovered timestamp value
Default: timestamp
<timezone> String - The timezone of the generated timestamp. If blank will default to java.util.TimeZone.getDefault()
User Property: 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: false
User Property: maven.buildNumber.useLastCommittedRevision
<username> String 1.0-beta-1 The username that is used when connecting to the SCM system.
User Property: username
<version> String 1.4 Version
Default: ${project.version}
<versionPropertyName> String 1.4 Java property name to store the project version
Default: 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

<ignoreEmptyScmUrl>

Ignore error when scm url from pom is empty and replace by scm:scmProvider scmProvider
  • Type: boolean
  • Since: 3.2.1
  • Required: No
  • User Property: maven.buildNumber.ignoreEmptyScmUrl
  • Default: false

<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}

<scmProvider>

When scm url is empty, scm provider is needed ignoreEmptyScmUrl
  • Type: java.lang.String
  • Since: 3.2.1
  • Required: No
  • User Property: maven.buildNumber.scmProvider
  • Default: git

<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