eclipse导入mavn工程报Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.6 的解决办法

时间:2021-08-03 11:47:44

详细报错:

Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from http://10.74.156.84:8085/nexus/content/groups/public/ was cached in the
local repository, resolution will not be reattempted until the update interval of U32_PUBLIC has elapsed or updates are forced. Original error: Could not
transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to U32_PUBLIC (http://10.74.156.84:8085/nexus/content/groups/public/):
connect timed out

错误信息出现在pom头的project标签,project标签内容是

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

 

原因

这是由于缺少maven-resources-plugin-2.6.jar文件。这个文件是在{user.home}\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\下。{user.home}是maven的配置路径,一般是我的文档,是window-preferences-MyEclipse-Maven4MyEclipse-User Setting里面的Local Repository。

解决方案

1、在pom.xml文件中加入maven-resources-plugin配置

<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</dependency>

  

2、在命令行下运行mvn install ,如果执行正确应该会在{user.home}\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\下看到maven-resources-plugin-2.6.jar文件

3、刷新工程(右键工程选择刷新项)

4、刷新maven配置,右键工程节点,选择Maven4MyEclipse-Update Project Configuration