`

maven Failed to resolve artifact

    博客分类:
  • JAVA
 
阅读更多

准备用

 

mvn archetype:create   -DgroupId=com.yourcompany  -DartifactId=myproject  -DarchetypeArtifactId=maven-archetype-quickstart 

 来建立一个空的maven工程,结果遇到下面的错误。

 

 

Caused by: org.apache.maven.artifact.resolver.ArtifactResolutionException: Failed to resolve artifact, possibly due to a
 repository list that is not appropriately equipped for this artifact's metadata.
  org.apache.maven.plugins:maven-archetype-plugin:pom:2.1-SNAPSHOT

 

查看具体的仓库中是有对应的pom以及jar 而且artifact也是对的,遂go之,发现以下2篇文章很有帮助。

 

1:Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact’s metadata

 

出处:http://www.8qiu.cn/2010/12/org-apache-maven-plugins-error/

 

解决办法是在pom指定插件的低版本,这个适用于工程已经建立好,但是使用的插件有问题的情况下。

 

 

2:Problem resolving snapshot version of plugin thru a Mirror

 

出处:http://maven.40175.n5.nabble.com/Problem-resolving-snapshot-version-of-plugin-thru-a-Mirror-td4367106.html

 

解决办法是修改meta中的版本为低版本。

 

 

最后再来追寻下问题的根源,是因为maven2总是会使用最新的插件版本,但是未必仓库会有,这个已经有bug提出了,见:

 

The "apache snapshots" repository shouldn't be in our default "public" group repository

 

https://issues.sonatype.org/browse/NEXUS-4251?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel

 

 

总结下上面的问题解决之道:

 

1:坚决使用新版本,那就确保仓库有最新的,同时确保最新的没有问题,有的时候是仓库里的meta信息有问题导致,这个需要删除重新再来过。

 

2:降低版本使用,这个不影响功能

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics