使用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 |