Maven - Version

Card Puncher Data Processing


Version in Maven can refere to:



To get the Maven Version, just execute this option

mvn --version
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 17:22:22+0200)
Maven home: C:\apache-maven-3.1.1\bin\..
Java version: 1.6.0_32, vendor: Sun Microsystems Inc.
Java home: C:\Progra~1\Java\jdk1.6.0_32\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"


Version is one component of the artifact defined in the pom and follows the semantic versioning scheme.


If version finishes with -SNAPSHOT, the release and deployment process follows the snapshot release process.

How to pass the pom version to the code

To replace the artifact version in a class during the build process, you can use the below plugin:



public class Version {
	private Version() {
		// don't instantiate

	public static String id() {
		return "@version@";
	public static void main(String[] args) {

Documentation / Reference

Discover More
Card Puncher Data Processing
Maven - Artifact - (Component|Module|Library)

in Maven. An Artifact is the data storage unit of a repository. It's at the same time: the distribution unit to distribute and the dependency unit to use (Ie artifacts can be transferred to...
Card Puncher Data Processing
Maven - Central Repository

The Central repository is the the default repository for Apache Maven but also for other build system such SBT. This is hosted on a nexus repository manager server. ...
Card Puncher Data Processing
Maven - Install (Local Package Installation)

Install is a phase that install the generated artifact in the local repository. deploy Plugin that can be used in this phase. install...
Card Puncher Data Processing
Maven - Mvn

-t,--toolchains -U,--update-snapshots Forces a check for updated releases and snapshots on remote repositories -up,--update-plugins Ineffective, only kept for backward compatibility -V,--show-version...
Card Puncher Data Processing
Maven - Plugin (Mojo)

A plugin (in Maven 2.0) groups together goals by code. It's an independent unit of code for Maven. It look like a dependency. In Maven, there are: Build plugins. They will be executed during the...
Card Puncher Data Processing
Maven - Project

A project in the Maven sense contains all little pieces that come into play to give code life. Ie: configuration files, the developers involved and the roles they play, the defect tracking system,...
Card Puncher Data Processing
Maven - Snapshot (Version|Dependency)

A snapshot is a artifact that has not been released. The difference between a release version and a snapshot version is that snapshots might get updates. The snapshot property of a artifact is defined...
Card Puncher Data Processing
Maven - pom.xml - Project Object Model

pom.xml is an XML representation of a Maven project known also as the project descriptor. It is ultimately a project declaration. Where as a build.xml tells ant precisely what to do when it is run (procedural),...
Card Puncher Data Processing
What are Java Coordinates?

The following attributes identifies uniquely an artifact (har,war,zip,...): groupid - the organisation artifactId - the software name version - the version classifier (source, doc, ...) packaging...

Share this page:
Follow us:
Task Runner