I use https://github.com/takari/maven-wrapper which is being adopted
and merged into maven as a core plugin as part of maven v3.7.0.

For me it allows each git commit to control what version of maven to
use, the developer and cicd for the same commit will be using the same
version of maven as they will both be building using mvnw.

Setup your maven wrapper for 3.3.9, change your cicd to use mvnw,
check it all works with 3.3.9.
Create a new branch and update maven wrapper to use 3.6.3 (simple
properties file change aka "mvn -N io.takari:maven:0.7.7:wrapper
-Dmaven=3.6.3"), commit and push, check your cicd still passes and
then merge into your develop/main branch.
Need to check or test an older commit or release, checkout that
branch/tag/commit because your using mvnw you don't need to remember
what version of maven was needed to build it as source control and
mvnw will handle it for you.

Some people have mention issues with some maven plugins when using the
maven wrapper, I've not had any issues in the 4 years I've been using
the takari maven wapper. But I don't use the maven release plugin, I
currently use https://github.com/aleksandr-m/gitflow-maven-plugin.

John

On Thu, 7 Jan 2021 at 21:51, Bernd Eckenfels <[email protected]> wrote:
>
> This (setting automatically of M2_HOME) does not work in all cases, 
> especially not if the launch script is not used (IDE or Maven Agents), but it 
> would be best to not set it, if not needed (agreed).
>
>
> --
> http://bernd.eckenfels.net
> ________________________________
> Von: Jörg Schaible <[email protected]>
> Gesendet: Thursday, January 7, 2021 10:38:45 PM
> An: Maven Users List <[email protected]>
> Betreff: Re: Maven 3.6.3 configuration enquiry
>
> Am Donnerstag, 7. Januar 2021, 20:23:27 CET schrieb Bernd Eckenfels:
> > You did not say what build servers you use, but normally you can have many
> > different maven versions installed in different directories. Usually CI
> > servers are fine to pick one (some like Jenkins can even install them
> > dynamically).
> >
> > If you do it, you need to watch out for not using/inheriting environment
> > variables (especially PATH, java and maven home), when using a user/global
> > settings.xml it should be valid for all versions (it usually is) or specify
> > a unique file for each environment with the -s flag. Also make sure to
> > specify the full path to the mvn launcher. Some plugins like maven release
> > plugin also prefer if you set the correct M2_HOME env variable.
>
> Best is not to set it at all. Then it is automatically set by the individual
> shell script that starts Maven (bin/mvn or bin/mvn.cmd) and will automatically
> point to the current Maven in use.
>
> [snip]
>
> Cheers,
> Jörg
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to