我有同样的问题。
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: Failure to find org.apache.maven.plugins:maven-resources-plugin:pom:2.5 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
...
已安装 maven 3.0.5、eclipse Kepler 和 JBoss Dev Studio 7。计算机位于内部网络上,具有互联网代理。这就是我所做的。
0.检查maven仓库服务器是否启动
1. 检查代理是否已设置并正常工作
首先我认为这是一个代理问题,我确保maven settings.xml包含代理设置(settings.xml可以存在于两个地方,一个在MAVEN_HOME中,另一个在%userprofile%.m2\中,后者具有更高的优先级) :
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>optional-proxyuser</username>
<password>optional-proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
并通过尝试 telnet 来检查代理是否正常工作:
telnet [proxy] [port number]
2.检查不是Eclipse问题
在 eclipse 之外的命令行级别运行“mvncompile”-同样的问题。
如果“mvn编译”有效。但是在eclipse中使用maven插件不行,参见Maven 插件不使用 eclipse 的代理设置 https://stackoverflow.com/questions/7737710/maven-plugin-not-using-eclipses-proxy-settings
3.检查不是缓存问题删除了我本地 Maven 存储库中的所有内容。 (默认位置:~/.m2/repository)然后重新运行maven - 出现了同样的问题。
4.什么对我有用
自动下载并安装缺少的插件:通过在 POM 文件构建部分中声明缺少的插件,Maven 将自动检索所需的插件。在 POM 文件中,为您需要的插件版本添加以下代码:
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
</plugin>
</plugins>
</pluginManagement>
</build>
手动安装缺少的插件:我去了http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5 http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5并下载了maven-resources-plugin-2.5.jar http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.jar and maven-resources-plugin-2.5.pom http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom。将其直接复制到 Maven 存储库中的正确文件夹中 ( ~/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.5) 并重新运行“mvncompile”。这解决了问题。
Edit1
接下来,我遇到了“mvn install”的另外两个问题:
The POM for org.apache.maven.plugins:maven-surefire-plugin:jar:2.10 is missing, no dependency information available
The POM for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1 is missing, no dependency information available
我以与上面相同的方式解决了这个问题,从下载http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin/2.10 http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin/2.10 and http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin/2.3.1 http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin/2.3.1