700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > Maven 报:Could not find artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3

Maven 报:Could not find artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3

时间:2022-08-19 15:39:27

相关推荐

Maven 报:Could not find artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3

前些时候我学习Maven,我遇到了以下两个错误(该死的这两个错误,让我浪费了四天时间):

1、Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:RELEASE from any of the configured repositories.

Could not resolve artifact

Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (D:\m2\repository)

Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (D:\m2\repository)

(这个错误是在新建项目的时候报的)

2、Could not calculate build plan: Could not find artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 in jboss-public-repository-group (/nexus/content/groups/public)AsamMilkTea5未知Maven Problem(这个错误是在构建的时候报出的)

以上报错的原因是:在settings.xml 文件中mirrors出了问题(Maven 2 Mirror的陷阱)。以前我是多个mirror 后来改为用一个mirror

<mirrors>

<mirror>

<id></id>

<name>ibiblio Mirror of /maven2/</name>

<url>/pub/mirrors/maven2</url>

<mirrorOf>central</mirrorOf>

</mirror>

</mirrors>

其它不要,就只要这个,就解决以上问题。

感谢welkin.hu,看了他的"Maven 2 Mirror的陷阱"这篇博文,是我解决这个问题的启发点。

Maven 2 Mirror的陷阱 (http://welkinhu./447606/107230)

Maven 2的安装和使用虽然不是一点即用,但也不是很复杂。然而,这两天我新装Maven,刚刚过了mvn -version,尝试create maven project就出问题了。问题详情如下。 D:\mavenSample>mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] org.apache.maven.plugins: checking for updates from central [INFO] org.codehaus.mojo: checking for updates from central [INFO] artifact org.apache.maven.plugins:maven-archetype-plugin: checking for updates from central [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3 seconds [INFO] Finished at: Wed Mar 19 14:26:49 CST [INFO] Final Memory: 1M/2M [INFO] ------------------------------------------------------------------------ 开始以为是internet 代理设置有问题。网上也有帖子这么说。可是换到ADSL后,不用代理了,问题仍然存在。 几经周折后发现,原因在于我画蛇添足多加了几个镜像,其中有的镜像没有同步更新maven库。经过测试,如下maven 镜像工作正常: <mirror> <id></id> <name>ibiblio Mirror of [url]/maven2/[/url]</name> <url> [url]/pub/mirrors/maven2[/url]</url> <mirrorOf>central</mirrorOf> <!-- United States, North Carolina --> </mirror> <mirror> <id></id> <url> [url]/maven2[/url]</url> <mirrorOf>central</mirrorOf> <!-- Shanghai, China , Very fast--> </mirror> <mirror> <id></id> <url> [url]/maven2[/url]</url> <mirrorOf>central</mirrorOf> <!-- Denmark --> </mirror> <mirror> <id>sunsite.dk</id> <url> [url]http://mirrors.sunsite.dk/maven2[/url]</url> <mirrorOf>central</mirrorOf> <!-- Denmark --> </mirror> <mirror> <id>skynet.be</id> <url> [url]http://maven2.mirrors.skynet.be/pub/maven2[/url]</url> <mirrorOf>central</mirrorOf> <!-- Belgium --> </mirror> <mirror> <id>cica.es</id> <url> [url]http://ftp.cica.es/mirrors/maven2[/url]</url> <mirrorOf>central</mirrorOf> <!-- Spain, Sevilla --> </mirror> <!-- these just point to --> <mirror> <id></id> <name> Mirror of [url]/maven2/[/url]</name> <url> [url]/pub/packages/maven2[/url]</url> <mirrorOf>central</mirrorOf> <!-- United States, North Carolina Fast--> </mirror> 而下面的Maven镜像都有问题。 <mirror> <id>planetmirror</id> <name>Australian Mirror of [url]/maven2/</name[/url]> <url> [url]/maven2/</url[/url]> <mirrorOf>central</mirrorOf> </mirror> <mirror> <id>lsu.edu</id> <url> [url]http://ibiblio.lsu.edu/main/pub/packages/maven2</url[/url]> <mirrorOf>central</mirrorOf> <!-- United States, Louisiana --> </mirror> <mirror> <id></id> <url> [url]/repository</url[/url]> <mirrorOf>central</mirrorOf> <!-- The Netherlands, Amsterdam --> </mirror> <mirror> <id>ggi-</id> <url> [url]http://ftp.ggi-/pub/packages/maven2</url[/url]> <mirrorOf>central</mirrorOf> <!-- The Netherlands, Amsterdam --> </mirror>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。