B.3. Maven 设置文件
Maven settings.xml 文件包含 Maven 的特定用户配置信息。它包含的信息不得通过 pom.xml 文件分发,如开发人员身份、代理信息、本地存储库位置,以及特定于用户的其他设置。
settings.xml 文件位于两个位置:
在 Maven 安装中:
settings.xml文件位于<maven-install-dir>/conf/目录中。这些设置称为全局设置。默认的 Maven 设置文件是一个模板,您可以复制该模板,并用作用户设置文件的起点。在用户安装中:
settings.xml文件位于${user.home}/.m2/目录中。如果 Maven 和用户settings.xml文件都存在,则内容将合并。如果存在重叠,用户的settings.xml文件优先。
例 B.2. Maven 设置文件
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<!-- Configure the JBoss AMQ Maven repository -->
<profile>
<id>jboss-amq-maven-repository</id>
<repositories>
<repository>
<id>jboss-amq</id>
<url>file:///path/to/repo/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jboss-amq-maven-plugin-repository</id>
<url>file://path/to/repo</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!-- Optionally, make the repository active by default -->
<activeProfile>jboss-amq-maven-repository</activeProfile>
</activeProfiles>
</settings>
其它资源
-
settings.xml文件的 schema 位于 http://maven.apache.org/xsd/settings-1.0.0.xsd。 - 有关 Maven 设置文件的更多信息,请参阅 Settings 参考。
修订于 2022-04-03 09:56:39 +1000