Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing maven versions when doing a deploy

Tags:

maven

pom.xml

I come to you looking for best practices on maven + version management.

I am trying to deploy a proyect to an artifact repository, but I'd like the version to be referred to the scm-version. I need to do this because I have many developers working against different "revisions" of the deployed library.

The pom configuration is the following:

<modelVersion>4.0.0</modelVersion>
<groupId>xxx.xxx.xxx</groupId>
<artifactId>xxx.xxx-parent</artifactId>
<version>${version}</version>
<packaging>pom</packaging>
<namexxxx Parent</name>

and when I do:

mvn deploy source:jar -Dversion=r203

the project is deployed correctly to the artifact repository..

The problem is, by adding the ${version} I am forcing everyone to use the -Dversion= when running any maven command.

I also thought of defining a property on the profiles.xml file but I am not sure this is the best way to do it.

What would you recommend to do on this situation?

Thanks a lot, Lucas

like image 849
Lucas Avatar asked Apr 17 '26 08:04

Lucas


1 Answers

I'd suggest using the versions plugin for maven

like image 109
Mark O'Connor Avatar answered Apr 26 '26 15:04

Mark O'Connor