如何为.m2文件夹或settings.xml永久指定替代位置? [英] How to specify an alternate location for the .m2 folder or settings.xml permanently?

查看:245
本文介绍了如何为.m2文件夹或settings.xml永久指定替代位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆