Changing the maven project version without changing the pom.xml.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Changing the maven project version without changing the pom.xml.

Mayur Kankanwadi
Hi All,

I am trying to accomplish setting the maven project version without
changing the pom.xml, so that the same pom.xml can be used across various
branches and the maven build is intelligent enough to figure out the
version name itself.
For this I am currently implementing a maven plugin which sets the
MavenProject instance version during the Validate phase. But am not seeing
the same being reflected in the final artifact, which is a jar.
How should I set this version without changing the pom.xml? The maven
versions plugin sets the version, but in the process changes the pom.xml,
which in case of multiple branches will become an overhead, as it is a two
step process.
Also is there any document which can explain the maven-core architecture?
The current javadocs are too concise and there is no guide which can show
the relation between the various core objects.

Thanks in advance.
--Mayur.
Reply | Threaded
Open this post in threaded view
|

Re: Changing the maven project version without changing the pom.xml.

Eric B
As of maven 3.5, there are 3 special parameters that you can use to specify
the pom version: revision, Shaw and changelist.  There have already been a
couple of threads on that topic on this list.

http://maven.40175.n5.nabble.com/Continuous-Delivery-with-Maven-now-possible-tp5907567.html

http://maven.40175.n5.nabble.com/Special-version-parameters-sha1-tp5916900.html


As well, khmarbaise  has written a blog on it as well.

http://blog.soebes.de/blog/2017/04/02/maven-pom-files-without-a-version-in-it/

You can also get additional info from the maven docs how to use it:
https://maven.apache.org/maven-ci-friendly.html

I'm still working out the kinks and details for my own projects as well.

Thanks

Eric

On Nov 29, 2017 4:28 AM, "Mayur Kankanwadi" <[hidden email]> wrote:

> Hi All,
>
> I am trying to accomplish setting the maven project version without
> changing the pom.xml, so that the same pom.xml can be used across various
> branches and the maven build is intelligent enough to figure out the
> version name itself.
> For this I am currently implementing a maven plugin which sets the
> MavenProject instance version during the Validate phase. But am not seeing
> the same being reflected in the final artifact, which is a jar.
> How should I set this version without changing the pom.xml? The maven
> versions plugin sets the version, but in the process changes the pom.xml,
> which in case of multiple branches will become an overhead, as it is a two
> step process.
> Also is there any document which can explain the maven-core architecture?
> The current javadocs are too concise and there is no guide which can show
> the relation between the various core objects.
>
> Thanks in advance.
> --Mayur.
>