修改Maven仓库地址


%USERPROFILE%\.m2\settings.xml例如:C:\Users\LongShu\.m2\settings.xml 
可以自定义Maven的一些参数, 
复制%M2_HOME%\conf\settings.xml到这个目录修改一下配置。

  1. 本地仓库 
    在settings节点里添加
<localRepository>D:\Dev_Tool\m2repository</localRepository>

本地仓库地址将从%USERPROFILE%\.m2\变为D:\Dev_Tool\m2repository\

  1. 远程仓库 
    在mirrors节点内添加
<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的仓库变为http的aliyun中央仓库。

  1. 修改项目仓库 
    在项目pom.xml的project节点内添加以下内容即可
<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>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM