我有一个问题,因为我想更改m2存储库路径,我在linux上我已经在我的settings.xml中添加了这个<localRepository>/tmp/m2Repo</localRepository>
但是当我执行命令mvn archetype:generate
时它会全部下载标准路径中的内容。
当我使用命令mvn archetype:generate -Dmaven.repo.local=/tmp/m2Repo
时,此命令成功。如何在命令行中不使用-Dmaven.repo.local=/tmp/m2Repo
并成功?
谢谢!
答案 0 :(得分:0)
存在两个设置位置。请确保您使用的是哪一个。检查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.
答案 1 :(得分:0)
您是否已从MAVEN_HOME或M2_HOME环境变量中检查过conf / settings.xml?