GitXplorerGitXplorer
j

semantic-versioning-with-maven

public
1 stars
1 forks
0 issues

Commits

List of commits on branch master.
Unverified
7392aa7c96bf926374293035d61fc2c08326ca44

README tells a bit more about the purpose of the example

jjan-molak committed 12 years ago
Unverified
12b4654534c2e58f39aca1a399b914045b4fc49a

README explains how to get the VERSION_NUMBER on a .jsp page

jjan-molak committed 12 years ago
Unverified
e58e91acf3ef70cabada34dda63b8f109fdd0296

Any references to %VERSION_NUMBER% in .jsp files are replaced with an actual semantic version number

jjan-molak committed 12 years ago
Unverified
e5be088333a3e64925c3ad2ac58fa93bd4af419d

AJ ONeal should get credit for his work on the semver regex

jjan-molak committed 12 years ago
Unverified
23db927069b1a1d3cb627de7bd14549d60a68ee7

Fixed layout of the example code

jjan-molak committed 12 years ago
Unverified
13b7a05b5f70a4b6789b9372aa0b5f8e7bbfdbce

README explains basic usage of the example

jjan-molak committed 12 years ago

README

The README file for this repository.

Semantic Versioning with Maven

This very simple maven project demonstrates how semantically correct version number can be inserted into the build manifest file (META-INF/MANIFEST.MF), as well as displayed on .jsp pages.

More info on semantic versioning can be found at http://semver.org

To validate user-specified buildVersion I used a regular expression developed by AJ ONeal https://gist.github.com/coolaj86/3012865

Example usage

# Run locally
mvn clean package

The above creates a package and generates a MANIFEST.MF file similar to the below:

  1 Manifest-Version: 1.0
  2 Build-Time: 20130321-1404
  3 Build-Java: 1.6.0_43
  4 Build-Qualifier: SNAPSHOT
  5 Built-By: janek
  6 Created-By: Apache Maven
  7 Build-Path: /Users/janek/Documents/projects/examples/simple-webapp
  8 Build-OS: Mac OS X
  9 Build-Jdk: 1.6.0_43
 10 Build-Version: 1.2.3+build
 11 Build-Maven: Maven 3.0.3
 12 Build-Label: 1.2.3-SNAPSHOT
 13 Build-User: janek
 14 Archiver-Version: Plexus Archiver

Note the Build-Version part: 1.2.3+build, which means "that's a current development version of 1.2.3".

To generate a version number containing the build number you can use one of the following:

# That's what you can run on your CI server
mvn clean package -D buildVersion=+build

mvn clean package -D buildVersion=-rc.1

mvn clean package -D buildVersion=-rc.1+build

mvn clean package -D buildVersion=-rc.1+build.1

mvn clean package -D buildVersion=+build

mvn clean package -D buildVersion=+build.69

mvn clean package -D buildVersion=+build.69.b8f12d7

which results in one of the following version strings:

 10 Build-Version: 1.2.3+build
 ...
 10 Build-Version: 1.2.3-rc.1
 ...
 10 Build-Version: 1.2.3-rc.1+build
 ...
 10 Build-Version: 1.2.3-rc.1+build.1
 ...
 10 Build-Version: 1.2.3+build
 ...
 10 Build-Version: 1.2.3+build.69
 ...
 10 Build-Version: 1.2.3+build.69.b8f12d7

Using VERSION_NUMBER in .jsp files

This example also presents how the semantic version string can be included in .jsp files. Any occurence of a %VERSION_NUMBER% token is replaced with an actual version number during maven's prepare-package phase.