1

I am using semantic versioning within my project, which I use Maven to build. Within the POM I would like to get hold of the components of the version number (ideally, as properties). How can I do that?

So, If my POM said

 <project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
... 
  <groupId>...</groupId>
  <artifactId>...</artifactId>
  <version>1.2.3-SNAPSHOT</version>
  <dependencies>...</dependencies>

I'd like to have properties like version.major="1", version.minor=2, version.patch="3".

Raedwald
  • 46,613
  • 43
  • 151
  • 237

0 Answers0