为什么我在 ~/.m2 下找不到我的 settings.xml?
Why can't I find my settings.xml under ~/.m2?
为什么我在 ~/.m2
下找不到我的 settings.xml?
注意:我目前 运行 Apache Maven 3.3.9
在我的机器上。
There are two locations where a settings.xml file may live:
The Maven install: ${maven.home}/conf/settings.xml
The 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 Settings Reference Guide
就这么简单
- 导航到
${maven.home}/conf/settings.xml
下的 maven 目录
- 并将您的 settings.xml 复制并粘贴到
${user.home}/.m2/
默认没有settings.xml文件。
如果需要,您应该创建文件。
运行 mvn -X
获取有关您的 Maven 安装的信息,如下所示
阿帕奇行家 3.6.0
Maven 主页:/usr/share/maven
Java 版本:11.0.2,供应商:Oracle Corporation,运行时:/usr/lib/jvm/java-11-openjdk-amd64
默认语言环境:en_IN,平台编码:UTF-8
OS 名称:"linux",版本:“4.15.0-47-generic”,架构:"amd64",系列:"unix"
警告:发生了非法的反射访问操作
警告:com.google.inject.internal.cglib.core.$ReflectUtils$1(文件:/usr/share/maven/lib/guice.jar)对方法 java.lang.ClassLoader.defineClass(java.lang.String,byte[], 的非法反射访问整数,整数,java.security.ProtectionDomain)
警告:请考虑将此报告给 com.google.inject.internal.cglib.core.$ReflectUtils$1
的维护者
在以上信息中,您将能够找到 settings.xml 如下所示的位置
[DEBUG] Message styles: debug info warning error success failure strong mojo project
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /home/test/.m2/settings.xml
[DEBUG] Reading global toolchains from /usr/share/maven/conf/toolchains.xml
[DEBUG] Reading user toolchains from /home/test/.m2/toolchains.xml
为什么我在 ~/.m2
下找不到我的 settings.xml?
注意:我目前 运行 Apache Maven 3.3.9
在我的机器上。
There are two locations where a settings.xml file may live:
The Maven install: ${maven.home}/conf/settings.xml
The 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 Settings Reference Guide
就这么简单
- 导航到
${maven.home}/conf/settings.xml
下的 maven 目录
- 并将您的 settings.xml 复制并粘贴到
${user.home}/.m2/
默认没有settings.xml文件。
如果需要,您应该创建文件。
运行 mvn -X
获取有关您的 Maven 安装的信息,如下所示
阿帕奇行家 3.6.0 Maven 主页:/usr/share/maven Java 版本:11.0.2,供应商:Oracle Corporation,运行时:/usr/lib/jvm/java-11-openjdk-amd64 默认语言环境:en_IN,平台编码:UTF-8 OS 名称:"linux",版本:“4.15.0-47-generic”,架构:"amd64",系列:"unix" 警告:发生了非法的反射访问操作 警告:com.google.inject.internal.cglib.core.$ReflectUtils$1(文件:/usr/share/maven/lib/guice.jar)对方法 java.lang.ClassLoader.defineClass(java.lang.String,byte[], 的非法反射访问整数,整数,java.security.ProtectionDomain) 警告:请考虑将此报告给 com.google.inject.internal.cglib.core.$ReflectUtils$1
的维护者在以上信息中,您将能够找到 settings.xml 如下所示的位置
[DEBUG] Message styles: debug info warning error success failure strong mojo project
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /home/test/.m2/settings.xml
[DEBUG] Reading global toolchains from /usr/share/maven/conf/toolchains.xml
[DEBUG] Reading user toolchains from /home/test/.m2/toolchains.xml