This plugin for Maven generates build meta data 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 meta data includes
For detailed information about the collected meta data and the properties that store them, please consult the listing of the build properties.
If your desired meta data is not included in the list, this is no show stopper! The Provider SPI allows you to add own implementations to provide additional meta data from any source and even export build information to remote systems.
Imagine the product is running on an application server. The product manager want to know,
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 meta data 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:
#Created by buildmetadata-maven-plugin.build.date=17.07.2010 19\:13\:00 build.copyright.year=2008-2010 build.date.pattern=dd.MM.yyyy HH\:mm\:ss build.timestamp.millis=1279386780654 build.year=2010 build.version=0.7.0 build.version.full=0.7.0-20100717r4223 build.host.name=DevBox001 build.user=john.doe build.maven.execution.cmdline=clean package build.maven.execution.goals=clean, package build.maven.execution.isRoot=true build.maven.execution.opts=-Xmx2048M -XX\:MaxPermSize\=256m build.maven.execution.profile.active.basic=settings.xml build.maven.execution.profile.active.nexus=settings.xml build.maven.execution.profiles.active=nexus, basic build.maven.version=2.2.1 build.scmLocallyModified=false build.scmRevision.date=16.07.2010 18\:12\:57 build.scmRevision.id=4223 build.scmRevision.url=scm\:svn\:https\://smartics.info/svn/smartics/maven/buildmetadata-maven-plugin/trunk
The generated information can be used in the Manifest file, using the maven-jar-plugin.
Manifest-Version: 1.0 Archiver-Version: Plexus Archiver Created-By: Apache Maven Build-Jdk: 1.6.0_20 Built-By: john.doe Built-OS: Windows 7 / amd64 / 6.1 Built-Host: DevBox001 Java-Vendor: Sun Microsystems Inc. Java-Version: 1.6.0_20 Maven-Version: 2.2.1 Specification-Vendor: smartics Specification-Title: buildmetadata-maven-plugin Specification-Version: 0.7.0 Implementation-Vendor: smartics Implementation-Vendor-Id: de.smartics.maven.plugin Implementation-Title: buildmetadata-maven-plugin Implementation-Version: 0.7.0 Implementation-URL: http://project.smartics.de/public/de.smartics.mave n.plugin/buildmetadata-maven-plugin/0.7.0 Implementation-Date: 17.07.2010 19:13:00 Implementation-DatePattern: dd.MM.yyyy HH:mm:ss Implementation-Timestamp: 1279386780654 Implementation-Full-Version: 0.7.0-20100717r4223 Implementation-SCM-Revision-Date: 16.07.2010 18:12:57 Implementation-SCM-Revision-Number: 4223
The information is not added automatically, but requires to be edited manually. Please refer to Use with JAR plugin for details.
Please note that other archive type can be configured similarly with e.g. the maven-ear-plugin or maven-war-plugin.
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.
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
-DbuildMetaData.hideCommandLineInfo=false -Ppassword=verySecret
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
p -DbuildMetaData.hideCommandLineInfo=false
(for those who do not know this plugin:
p
is an alias for -T 4 clean package) does not mask the commandline:<commandline>-T 4 clean package -DbuildMetaData.hideCommandLineInfo=false</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.