1. 程式人生 > >maven中setting.xml配置詳解

maven中setting.xml配置詳解

<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
                          https://maven.apache.org/xsd/settings-1.0.0.xsd">
	<!-- 地儲存庫的路徑。預設值為$ {user.home}/.m2/repository -->
	<localRepository>E:/work/maven-repository</localRepository>
	<!-- 是否使用互動模式,預設是true。如果設為false,那麼當Maven需要使用者進行輸入的時候,它會使用一個預設值。 -->
	<!-- <interactiveMode>false</interactiveMode> -->
	<!-- 考慮Maven應使用$ {user.home}/.m2/plugin-registry.xml檔案來管理外掛版本,需要則設定為true,預設為false -->
	<!-- <usePluginRegistry>false</usePluginRegistry> -->
	<!-- 如果此構建系統需要在離線模式下執行,則為true,預設為false。由於網路設定或安全原因,此元素對於無法連線到遠端儲存庫的構建伺服器很有用。 -->
	<!-- <offline>false</offline> -->
	<!-- 該元素包含一個pluginGroup元素列表 -->
	<!-- <pluginGroups/> -->
	<!-- 一系列的server子元素,表示當需要連線到一個遠端伺服器的時候需要使用到的驗證方式,如: 
	<servers>
		<server>
			<id>id</id>
			<username>使用者名稱</username>
			<password>密碼</password>
		</server>
	</servers>
	-->
	<!-- <servers/> -->
	<!-- 配置mirrors遠端映象 -->
    <mirrors>
	    <mirror>
		    <id>alimaven</id>
		    <name>aliyun maven</name>
		    <url>http://maven.aliyun.com/mvn/view</url>
		    <mirrorOf>central</mirrorOf>
	    </mirror>
    </mirrors>
	<!-- 代理 -->
	<!-- <proxies /> -->
</settings>

我的配置:

<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
                          https://maven.apache.org/xsd/settings-1.0.0.xsd">
	<!-- 地儲存庫的路徑。預設值為$ {user.home}/.m2/repository -->
	<localRepository>E:/work/maven-repository</localRepository>
	<!-- 配置mirrors遠端映象 -->
	<mirrors>
		<mirror>
			<id>nexus-aliyun</id>
			<name>Nexus aliyun</name>
			<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
			<mirrorOf>*</mirrorOf>
		</mirror>
		<mirror>
			<id>apachemaven</id>
			<name>apache-maven</name>
			<url>http://repo.maven.apache.org/maven2/</url>
			<mirrorOf>central</mirrorOf>
		</mirror>
	</mirrors>
</settings>