新装mvn建第一个项目报错org.apache.maven.plugins:maven-resources-plugin:2.6

时间:2022-02-18 14:07:58

1、第一次创建mvn项目会报maven-resources-plugin-2.6.jar错,原因是mvn无法自动下载这个jar包,多次删除这个目录下的C:\Users\Administrator\.m2\repository\org\apache\maven\plugins(你自己的目录)所有文件(有时候会解决,有的时候不会解决这个问题),自动下载maven-resources-plugin-2.6.jar还是不行(多次从装都没有这个问题,最近换了网络,估计是网络不行造成的)。

2、解决方法:在mvn项目下pom.xml文件下手动

项目有jar包可以直接在里边加上这段

<dependency>

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

如果是新装没有jar包的话直接输入会报错

 加一个标签即可

<dependencies>

   <dependency>

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

</dependencies>

在建好的mvn项目上run as --》maven install下载即可

3、总结大部分出现这种错误的直接删除1、中的目录下文件 新建mvn项目即可解决,如果无法解决请按照2、进行操作即可。

我的报错信息如下:


Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'shouka_merchant'.
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Errors running builder 'Maven Project Builder' on project 'shouka_new'.
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6