Maven Settings.xml 配置模板

Maven Settings.xml 配置模板

<?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">
	<!-- 配置本地仓库 -->
	<localRepository>x:/xxx_repository</localRepository>
	<servers>
		<server>
			<id>xxx-releases</id>
			<username>xxx</username>
			<password>xxx</password>
		</server>
		<server>
			<id>xxx-snapshot</id>
			<username>xxx</username>
			<password>xxx</password>
		</server>
	</servers>
	<!-- 配置镜像 -->
	<mirrors>
		<mirror>
			<id>nexus</id>
			<!-- 表示该镜像匹配所有仓库,任何对于远程仓库的请求都会被转至 http://xxx.xxx.xxx.xxx:xxx/nexus/content/groups/public/  -->
			<mirrorOf>*</mirrorOf>
			<url>http://xxx.xxx.xxx.xxx:xxx/nexus/content/groups/public/</url>
		</mirror>
	</mirrors>
	<!-- 使用 settings.xml 的 profile 机制配置(本机)全局仓库信息 -->
	<profiles>
		<profile>
			<id>nexus</id>
			<repositories>
				<repository>
					<!-- id都为central,也就是说,覆盖了超级POM中央仓库的配置 -->
					<id>central</id>
					<url>http://central</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
				</repository>
			</repositories>
			<pluginRepositories>
				<pluginRepository>
					<id>central</id>
					<url>http://central</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
				</pluginRepository>
			</pluginRepositories>
		</profile>
	</profiles>
	<activeProfiles>
		<activeProfile>nexus</activeProfile>
	</activeProfiles>
</settings>

注: x:按照自己实际配置的参数

原文地址:https://www.cnblogs.com/simpleJokerKing/p/14202514.html