1、代理
<proxies>
<proxy>
<id>optional</id>//代理名
<active>true</active>//true激活該代理
<protocol>http</protocol>//代理協議
<username>proxyuser</username>//帳號密碼
<password>proxypass</password>
<host>proxy.host.net</host>//主機名,可以有多個,用"|"分隔
<port>80</port>//端口號
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>//指定哪些不用代理
</proxy>
</proxies>
2、設定本地倉庫
<localRepository>D:/Development/m2/repository</localRepository>
本地倉庫地址設定
3、遠程倉庫配置
<repositories>
<repository>
<id>nexus</id>//不能重複,中央倉庫就是central
<name>local private nexus</name>//描述
<url>http://maven.oschina.net/content/groups/public/</url>//倉庫地址
<releases>
<enabled>true</enabled>//支持獲取release版本的
<updatePolicy>daily</updatePolicy>//構件更新頻率
<checksumPolicy>ignore</checksumPolicy>//檢證構建時,以何種方式提示
</releases>
<snapshots>
<enabled>false</enabled>//不支持獲取snapshots版本的
</snapshots>
</repository>
</repositories>
updatePolicy可能值
never:不更
always:每次構建都檢查更新
interval:每隔X分鐘檢查一次
checksumPolicy可能值
warn:出錯警告
fail:出錯讓構建失敗
ignore:讓maven完全忽略
4、配置倉庫認證信息
<servers>
<server>
<id>deploymentRepo</id>
<username>repouser</username>
<password>repopwd</password>
</server>
</servers>
5、設置鏡像
<mirrors>
<mirror>
<id>mirrorId</id>//唯一標識符
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
<mirror>
當用戶請求mirrorOf中配置的倉庫時,會跳轉到url中的地址
*//匹配所有遠程倉庫
external:*//匹配所有不在本機上的遠程倉庫
repo1,repo2//匹配倉庫repo1和repo2
*,!repo1//除了repo1外的所有倉庫
如果需要認證,則加一個id與中一樣的標籤配置