首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更改m2存储库路径

更改m2存储库路径
EN

Stack Overflow用户
提问于 2016-02-12 18:41:35
回答 2查看 986关注 0票数 0

我有一个问题,因为我想要更改m2存储库路径,我在linux上,我在我的settings.xml中添加了这个<localRepository>/tmp/m2Repo</localRepository>,但是当我执行命令mvn archetype:generate时,它会下载标准路径中的所有内容。

当我使用命令mvn archetype:generate -Dmaven.repo.local=/tmp/m2Repo时,这个命令是成功的。我如何才能在命令行中不使用-Dmaven.repo.local=/tmp/m2Repo并取得成功?

谢谢!

EN

回答 2

Stack Overflow用户

发布于 2016-02-12 18:52:13

存在设置的位置有两个。请确定您使用的是哪一个。检查manual,检查文件属性。

代码语言:javascript
复制
One is Maven install (global), second is inside user account.
The settings element in the settings.xml file contains elements used to define values which configure Maven execution in various ways, like the pom.xml, but should not be bundled to any specific project, or distributed to an audience. These include values such as the local repository location, alternate remote repository servers, and authentication information.

There are two locations where a settings.xml file may live:

    The Maven install: $M2_HOME/conf/settings.xml
    A user’s install: ${user.home}/.m2/settings.xml

The former settings.xml are also called global settings, the latter settings.xml are referred to as user settings. If both files exists, their contents gets merged, with the user-specific settings.xml being dominant.

Tip: If you need to create user-specific settings from scratch, it’s easiest to copy the global settings from your Maven installation to your ${user.home}/.m2 directory. Maven’s default settings.xml is a template with comments and examples so you can quickly tweak it to match your needs.
票数 0
EN

Stack Overflow用户

发布于 2016-02-12 18:53:51

您是否已经从MAVEN_HOME或M2_HOME环境变量中检查了conf/settings.xml?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35360494

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档