开发者

Set .m2 for a single build-job to different location

For a build-job on a build-server, I want to set the .m2 location to something different from user.home/.m开发者_开发技巧2.

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 :

  • maven.apache.org (on maven-1.x website but still works with maven 3.0 - can't find a reliable source for this version though)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜