如何为.m2文件夹或settings.xml永久指定替代位置? [英] How to specify an alternate location for the .m2 folder or settings.xml permanently?
问题描述
我正在使用Maven 3.0,我的.m2
文件夹位置是C:\Users\me\.m2
.
I am using Maven 3.0, and my .m2
folder location is C:\Users\me\.m2
.
但是,我没有对该文件夹的写访问权,但是我想将存储库的位置从settings.xml
中定义的位置更改.
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
.
由于访问受限,我无法编辑settings.xml
来更改存储库的位置.
Due to restricted access, I am not able to edit the settings.xml
to change the repository location.
如何在不编辑C:\Users\me\.m2\conf\settings.xml
文件的情况下覆盖settings.xml
的值-或更改.m2
文件夹的默认位置?
How can I override the values of my settings.xml
-or change the default location of the .m2
folder- without editing my C:\Users\me\.m2\conf\settings.xml
file?
推荐答案
您需要将此行添加到您的settings.xml
中(如果已存在,请取消注释).
You need to add this line into your settings.xml
(or uncomment if it's already there).
<localRepository>C:\Users\me\.m2\repo</localRepository>
还可以使用mvn clean install -gs C:\Users\me\.m2\settings.xml
运行命令-此参数将强制maven使用与默认值不同的settings.xml
(位于$HOME/.m2/settings.xml
中)
Also it's possible to run your commands with mvn clean install -gs C:\Users\me\.m2\settings.xml
- this parameter will force maven to use different settings.xml
then the default one (which is in $HOME/.m2/settings.xml
)
这篇关于如何为.m2文件夹或settings.xml永久指定替代位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!