我有一个问题,因为我想要更改m2存储库路径,我在linux上,我在我的settings.xml中添加了这个<localRepository>/tmp/m2Repo</localRepository>,但是当我执行命令mvn archetype:generate时,它会下载标准路径中的所有内容。
当我使用命令mvn archetype:generate -Dmaven.repo.local=/tmp/m2Repo时,这个命令是成功的。我如何才能在命令行中不使用-Dmaven.repo.local=/tmp/m2Repo并取得成功?
谢谢!
发布于 2016-02-12 18:52:13
存在设置的位置有两个。请确定您使用的是哪一个。检查manual,检查文件属性。
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.发布于 2016-02-12 18:53:51
您是否已经从MAVEN_HOME或M2_HOME环境变量中检查了conf/settings.xml?
https://stackoverflow.com/questions/35360494
复制相似问题