Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven build - version information

Tags:

java

maven

We specify versionId in POM and correspondingly maven produces foo-version.jar. Example: foo-1.0-SNAPSHOT.jar.

Is it possible to do do the following with maven?

  • Not specify versionId in POM but specify build version from command line. This will help not "hardcode" the version in POM and changing it for each release, but specify it through a super build script.
like image 677
gammay Avatar asked Aug 28 '13 07:08

gammay


1 Answers

Set project version in pom as a place holder

<groupId>test</groupId>
<artifactId>x</artifactId>
<version>${project.version}</version>

now you can pass version from command line

mvn -Dproject.version=1.1.1 package
like image 142
Evgeniy Dorofeev Avatar answered Nov 07 '22 09:11

Evgeniy Dorofeev