Generates build metadata and provides it as Maven build properties. The properties are written to a properties file that can be included in the generated artifact. The information can also be added to the manifest file.
This Maven plugin generates build metadata and provides it as Maven build properties. The properties are written to a properties file that can be included in the generated artifact. The information can also be added in an XML format or to the manifest file.
The metadata includes
- SCM information
- revision number
- revision date
- locally modified files
- URL of SCM server
- build time
- operating system
- Java runtime
- virtual machine
- Maven execution information
- Maven version
- filter files
- active profiles
- environment properties
- command line and executed goals
- build user
- build host name
- Artifact and version
- group ID
- artifact ID
- build version
- project info
- home page URL
For detailed information about the collected metadata and the properties that store them, please consult the listing of the build properties.
If your desired metadata is not included in the list, this is no show stopper! The Provider SPI allows you to add own implementations to provide additional metadata from any source and even export build information to remote systems.
Why add Metadata to the Artifact?
Imagine the product is running on an application server. The product manager want to know,
- which version of which artifact is currently running on that server?
- which artifact maps to which source code version in the SCM repository?
- what configuration set (including profiles and environment variables) has been used to generate the artifact?
- on which machine was the artifact built?
- when was the artifact built?
If you have no answers to these questions, but love to have, this tool is for you. It allows you to add this information easily as metadata to all kinds of Java archives.
The following sections show the artifacts provided by this plugin.
The generated properties file is per default added to the
META-INF folder of the archive and can be easily accessed at runtime. It contains the following information:
The generated information can be used in the Manifest file, using the maven-jar-plugin.
The information is not added automatically, but requires to be edited manually. Please refer to Use with JAR plugin for details.
To map a site documentation to an artifact (and vice versa), a build report can be integrated into the site documentation. This report contains build information like the revision and revision date.
The Build Report of this project may serve as an example.
One Word of Warning
Build metadata may contain sensitive information you do not want to expose. If you include the commandline to document how the build has been started using
This line will be part of the report!
Please also note that the commandline contains the information as digested by Maven. Any variable replacements or using the alias-maven-plugin as in
(for those who do not know this plugin:
p is an alias for -T 4 clean package) does not mask the commandline:
We tried to make the default configuration very restrictive. But nonetheless we advice you to double check the build metadata you include into your artifacts. Especially if these artifacts are published to anonymous third parties.
Please have a look at the sample usage patterns.
The buildmetadata:provide-buildmetadata documentation details the configuration options.
The following posts provide more information about this plugin on our blog.
Blog: Red Hat released Version 1.5.0 of their buildmetadata-plugin Fork!
Oct 11, 2014
Blog: buildmetadata-maven-plugin 1.4.0 has been released!
Feb 28, 2014
Blog: Automatic for the Team
Nov 05, 2013
Blog: Great News: Buildmetadata Maven Plugin forked!
Nov 04, 2013
Blog: buildmetadata-maven-plugin 1.2.0 has been released!
Oct 03, 2013
Blog: Buildmetadata is Part of every Artifact provided by smartics
Sep 06, 2012
Sep 01, 2012