blob: d827a2011387630b13153cf312cec4f01af556d0 [file] [log] [blame]
-----
Cookbook - How To Add SVN Revision To A JAR Manifest
-----
Vincent Siveton
Karl Heinz Marbase
-----
2015-06-12
-----
~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements. See the NOTICE file
~~ distributed with this work for additional information
~~ regarding copyright ownership. The ASF licenses this file
~~ to you under the Apache License, Version 2.0 (the
~~ "License"); you may not use this file except in compliance
~~ with the License. You may obtain a copy of the License at
~~
~~ http://www.apache.org/licenses/LICENSE-2.0
~~
~~ Unless required by applicable law or agreed to in writing,
~~ software distributed under the License is distributed on an
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~~ KIND, either express or implied. See the License for the
~~ specific language governing permissions and limitations
~~ under the License.
~~ NOTE: For help with the syntax of this file, see:
~~ http://maven.apache.org/doxia/references/apt-format.html
Cookbook: How To Add SVN Revision To A JAR Manifest?
* Summary
This recipe describes how to add SVN revision to a JAR manifest.
* Prerequisite Plugins
Here is the list of the plugins used:
*-----------------------------------------------------------+--------------+
|| <<Plugin>> || <<Version>>
*-----------------------------------------------------------+--------------+
| {{{../../plugins/maven-jar-plugin/} <<<jar>>>}} | 2.6
*-----------------------------------------------------------+--------------+
| {{{http://www.mojohaus.org/buildnumber-maven-plugin/} <<<buildnumber>>>}} | 1.3
*-----------------------------------------------------------+--------------+
* Sample Generated Manifest
+-----+
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: vsiveton
Build-Jdk: 1.5.0_12
SCM-Revision: 613393
+-----+
* Recipe
** Configuring Mojo Buildnumber Plugin
We configure this plugin as suggested in the {{{http://www.mojohaus.org/buildnumber-maven-plugin/usage.html}Mojo Buildnumber Plugin usage}} page.
%{snippet|id=buildnumber|url=https://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/generate-svn-revision/pom.xml}
** Configuring Maven Jar Plugin
The last configuration is to customize the default Manifest with a new entry for the SCM revision.
%{snippet|id=jar|url=https://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/generate-svn-revision/pom.xml}
** Running Maven
Just call Maven to generate the package:
+-----+
mvn package
+-----+
<<Note>>: You need to have committed your project into SVN.
* Other Tips
You could tweak the Jar Plugin configuration into the War Plugin.
* Resources
* Source code: {{{https://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/generate-svn-revision}https://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/generate-svn-revision}}
* {{{../../plugins/maven-jar-plugin/} Maven Jar Plugin}}
* {{{http://www.mojohaus.org/buildnumber-maven-plugin/} Mojo Buildnumber Maven Plugin}}
[]