Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved

前端 未结 29 1190
执笔经年
执笔经年 2020-11-22 11:56
org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Faile         


        
相关标签:
29条回答
  • 2020-11-22 12:29

    I had the exact same problem and since I read somewhere that the error was caused by a cached file, I fixed it by deleting all the files under the .m2 repository folder. The next time I built the project I had to download all the dependencies again but it was worth it - 0 errors!!

    0 讨论(0)
  • 2020-11-22 12:31

    I had the exact same problem.

    [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]
    ...
    

    Had maven 3.0.5, eclipse Kepler with JBoss Dev Studio 7 installed. Computer sitting on internal network with proxy to the internet. Here's what I did.

    0. Check the maven repositiory server is up

    1. Check Proxy is set up and working

    First I thought it was a proxy problem, I made sure that maven settings.xml contained the proxy settings (settings.xml can exist in two places one in MAVEN_HOME. The other in %userprofile%.m2\ with the later having higher precedence):

    <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>
    

    and checked that the proxy is working by trying to telnet to it:

    telnet [proxy] [port number]
    

    2. Check not Eclipse Issue

    ran 'mvn compile' at command line level outside of eclipse - same issue.

    If 'mvn compile' worked. But it doesn't work using the maven plugin in eclipse, see Maven plugin not using eclipse's proxy settings

    3. Check not Cache Issue Deleted all contents in my local maven repository. (Default location: ~/.m2/repository) And then reran maven - same issue came up.

    4. What worked for me

    Automatically download & install missing plugin: By declaring the missing plugin in the POM file build section for pluginManagement Maven will automatically retrieve the required plugin. In the POM file, add this code for the version of the plugin you require:

      <build>
            <pluginManagement>
              <plugins>
                <plugin>
                  <artifactId>maven-resources-plugin</artifactId>
                  <version>2.7</version>
                </plugin>           
              </plugins>
            </pluginManagement>   
        </build>
    

    Manually install missing plugin: I went to http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5 and downloaded maven-resources-plugin-2.5.jar and maven-resources-plugin-2.5.pom . Copied it directly into the maven repository into the correct folder ( ~/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.5) and reran 'mvn compile'. This solved the problem.


    Edit1

    Following this I had another two problem with '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
    

    I approached this problem the same way as above, downloading from 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

    0 讨论(0)
  • 2020-11-22 12:31

    Some files where missing at your local repository. Usually under ${user.home}/.m2/repository/

    Neets answer solves the problem. However if you dont want do download all the dependencies to your local repository again you could add the missing dependency to a project of yours and compile it.

    Use the maven repository website to find the dependency. In your case http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5 was missing.

    Copy the listed XML to the pom.xml file of your project. In this case

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

    Run mvn compile in the root folder of the pom.xml. Maven will download all missing dependencies. After the download you can remove the added dependency.

    Now you should be able to import the maven project or update the project without the error.

    0 讨论(0)
  • 2020-11-22 12:31

    I am facing the same issue and none of above works, like by updating the MVN also same error, by building is also same, entered details in settings.xml though even same issue.

    After that again I tried and did something different which did not did before and it works.

    Its simple, I clicked the force update while updating the Mvn project. By right clicking on the pom file, there is option under Maven, "Update Project" and it open up one popup to select update option. PLEASE MAKE SURE FORCE UPDATE IS CHECKED, by default is unchecked. And bingo, that works like charm!

    0 讨论(0)
  • 2020-11-22 12:32

    i faced the same issue while using eclipse kepler and maven version 3.2,

    while building the project, it showed me the same error in eclipse

    there are two versions (2.5 and 2.6) of plugin under

    .m2/repository/org/apache/maven/plugins/maven-resources-plugin/
    

    i removed 2.5 version then it worked for me

    0 讨论(0)
  • 2020-11-22 12:34

    A more subtle reason for this could be a Settings.xml file which has a space in the first line before the doctype

    0 讨论(0)
提交回复
热议问题