Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
697 views
in Technique[技术] by (71.8m points)

maven - How to specify an alternate location for the .m2 folder or settings.xml permanently?

I am using Maven 3.0, and my .m2 folder location is C:Usersme.m2.

However, I do not have write access to that folder, but I want to change the repository location from the one defined in the settings.xml.

Due to restricted access, I am not able to edit the settings.xml to change the repository location.

How can I override the values of my settings.xml -or change the default location of the .m2 folder- without editing my C:Usersme.m2confsettings.xml file?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You need to add this line into your settings.xml (or uncomment if it's already there).

<localRepository>C:Usersme.m2
epo</localRepository>

Also it's possible to run your commands with mvn clean install -gs C:Usersme.m2settings.xml - this parameter will force maven to use different settings.xml then the default one (which is in $HOME/.m2/settings.xml)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...