For a build-job on a build-server, I want to set the .m2
location to something different from user.home/.m2
.
I thought I could trick maven by setting export HOME=$WORKSPACE
for the build, but artifacts kept being downloaded and being deployed to the build user's home directory.
Therefore I think that maven uses the user.home
system property which seems to not take $HOME
into account.
Is there a solution for this? We have a local maven cache, and I do want to download all artifacts for this build-job and prevent any deployment into the build-user's $HOME/.m2
in order to seperate individual build jobs from each other. At least I want this for some jobs.
Any ideas? Thanks in advance!
You can override the location of the settings.xml file from the command line...
mvn <target> --settings /path/to/settings.xml
From here you can customize anything you would need.
[update] You can even override the "global" settings which are typically merged with the user's settings.xml form their .m2 directory via --global-settings /path/to/global/settings.xml
If you just want to specify your own local repository you can use the option maven.repo.local
:
-Dmaven.repo.local=/path/to/your/repository
Resources :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With