Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 更改m2存储库路径_Java_Maven 3 - Fatal编程技术网

Java 更改m2存储库路径

Java 更改m2存储库路径,java,maven-3,Java,Maven 3,我有一个问题,因为我想更改m2存储库路径,我在linux上,我在我的settings.xml中添加了这个/tmp/m2Repo,但是当我执行命令mvn-archetype:generate时,它会下载标准路径中的所有内容 当我使用命令mvn原型:generate-Dmaven.repo.local=/tmp/m2Repo时,这个命令是成功的。如何使命令行中不使用-Dmaven.repo.local=/tmp/m2Repo,并且成功 谢谢大家! 存在两个设置位置。请确定你用的是哪一个。检查,检查文

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

当我使用命令
mvn原型:generate-Dmaven.repo.local=/tmp/m2Repo
时,这个命令是成功的。如何使命令行中不使用
-Dmaven.repo.local=/tmp/m2Repo
,并且成功


谢谢大家!

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

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.

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

作为黑客,将
~/.M2
目录移动到
/tmp
并添加符号链接可能会有所帮助。您是否正在编辑{M2_HOME}/conf/settings.xml?您的
设置.xml在哪里?在
$HOME/.m2/settings.xml中是否正确?