修改Maven倉庫地址
在%USERPROFILE%\.m2\settings.xml例如:C:\Users\Administrator\.m2\settings.xml
可以自定義Maven的一些參數(shù),
復(fù)制%M2_HOME%\conf\settings.xml到這個目錄修改一下配置。
本地倉庫
在settings節(jié)點里添加
<localRepository>D:\maven\m2repository</localRepository>
本地倉庫地址將從%USERPROFILE%.m2\變?yōu)镈:\maven\m2repository\
遠程倉庫
在mirrors節(jié)點內(nèi)添加
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
<mirror>
<id>jcenter</id>
<mirrorOf>central</mirrorOf>
<name>jcenter.bintray.com</name>
<url>http://jcenter.bintray.com/</url>
</mirror>
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
將把原來https的倉庫變?yōu)閔ttp的aliyun中央倉庫。
修改項目倉庫
在項目pom.xml的project節(jié)點內(nèi)添加以下內(nèi)容即可
<repositories>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</repository>
<repository>
<id>jcenter</id>
<name>jcenter Repository</name>
<url>http://jcenter.bintray.com/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>