使用maven的java項目編譯和發佈錯誤,有些是maven倉庫引發的,java
例如dependencies could not be resolved錯誤,這個錯誤的提示有可能象這樣:
node
[ERROR] Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 in http://maven.aliyun.com/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus-aliyun has elapsed or updates are forcedspring
有同窗遇到這個問題,他這個項目的maven配置文件爲:apache
......maven
<localRepository>D:\workspace-4.7\repository</localRepository>ide
......gradle
<mirrors>google
<mirror>阿里雲
<id>nexus-aliyun</id>url
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
......
實際上http://maven.aliyun.com/nexus/content/groups/public已是老地址了,老地址有不可預料的各類問題,須要改成新地址:
......
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里雲公共倉庫</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
......
阿里雲的新地址彙總以下:
倉庫名稱 |
阿里雲倉庫地址 |
阿里雲倉庫地址(老版) |
源地址 |
---|---|---|---|
central |
|||
jcenter |
|||
public |
central倉和jcenter倉的聚合倉 |
||
gradle-plugin |
https://maven.aliyun.com/nexus/content/repositories/gradle-plugin |
||
spring |
|||
spring-plugin |
https://maven.aliyun.com/nexus/content/repositories/spring-plugin |
||
grails-core |
https://maven.aliyun.com/nexus/content/repositories/grails-core |
||
apache snapshots |
https://maven.aliyun.com/nexus/content/repositories/apache-snapshots |