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

org.apache.maven.plugin.PluginResolutionException: 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
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129)
    at org.eclipse.m2e.core.internal.project.registry.EclipsePluginDependenciesResolver.resolve(EclipsePluginDependenciesResolver.java:48)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:142)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:152)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.setupMojoExecution(MavenImpl.java:386)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.setupMojoExecution(ProjectRegistryManager.java:865)
    at org.eclipse.m2e.core.internal.project.registry.MavenProjectFacade.getMojoExecution(MavenProjectFacade.java:355)
    at org.eclipse.m2e.core.project.configurator.AbstractCustomizableLifecycleMapping.getBuildParticipants(AbstractCustomizableLifecycleMapping.java:66)
    at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:87)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:414)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:351)
    at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:74)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
    at org.sonatype.aether.impl.internal.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:279)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:115)

I have read where many people were able to solve this by:

I am new to Maven so please excuse any of my ignorance.

This project is working on another machine, and just pulled it down from the repository on this one, with the same version of eclipse and m2e plugin installed. I have been fooling with this for over 10 hours now and it is driving me nuts (Maven has been nothing but headaches for me so far...)

EDITS

After looking closer I did notice that it is not downloading the .jar files into the local repository... I am not sure if that is something obvious...

I am not given the option to add Maven Dependencies to the build path.

This question is related to java eclipse maven jakarta-ee m2eclipse

The answer is


If you have a proxy, you also have to clear SOCKS in

Window > Preferences > Network Connections.

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


My problem was the location of the config file.

In eclipse settings (Windows->preferences->maven->User Settings) the default config file for maven points to C:\users\*yourUser*\.m2\settings.xml. If you unzip maven and install it in a folder of your choice the file will be inside *yourMavenInstallDir*/conf/, thus probably not where eclipse thinks (mine was not). If this is the case maven won't load correctly. You just need to set the "User Settings" path to point to the right file.


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!


If you've configured a repository in your maven's settings.xml, check if you've access to it.

When I had this problem, there were enterprise repositories configured in settings.xml but I was out of the company.


I could solve the issue with the following steps

  1. Install Maven separately
    https://www.mkyong.com/maven/how-to-install-maven-in-windows/
  2. Set the external Maven installation in Eclipse
    enter image description here


3. Set the proxy in settings.xml in Maven installation
(C:\path\apache-maven-3.6.0\conf)

<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>
  1. Update the Maven User Settings enter image description here

  2. Update Maven project
    enter image description here


JackDev's option 3 works for me after I changed the default repository to another folder.

Below is what I see after M2E plugin automatically download the maven-resources-plugin-2.6. Maybe this could give you some hint if you want to take the manual approach. The necessary files can be downloaded from here: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/

enter image description here


Very old stuff.

Got it solved fixing the localRepository in settings.xml. This file was copied from my other computer and the path of the .m2 repository wasn't the same.

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <localRepository>C:\Users\foo\.m2</localRepository>

</settings>

I have shifted my project to a different machine, copied all my maven libraries from old machine to new machine, did Right click on my project >> Maven >> Update Project. And then built my project. In addition to this, I have also done this one step which is shown in screenshot. And that's all it worked!!

Go to Window --> Preferences --> Maven --> User Setting, make sure you have these settings..
enter image description here

Also Right click on your project --> Properties --> Maven, and make sure you have the path here to maven repository..
enter image description here


You should check Force Update Snapshots/Releases when updating project with maven.It worked for me :-). Force Update Snapshots/Releases


Couple of things to try:

  1. Doublecheck the location of the local artifact repo configured in your settings.xml file (at the following location {your home folder}/.m2/settings.xml). Are you sure the local repo is where you think it is? (Yes, a mistake I've made in the past...)
  2. Remove entire contents of artifact repo on the new build machine (or at least anything related to Maven). You mentioned doing some artifact repo cleanup but I'm not sure what directory(ies) you removed. I've run into weird issues like these when a jar was corrupted.
  3. Make sure you have enough disk space/quota for the local artifact repo. I have run into weird issues when I didn't have a large enough quota to hold all the artifacts, likely caused by partially downloaded jar files.
  4. Try running with plain Maven on the command line; take Eclipse and m2e out of the equation. mvn -U dependency:resolve should do it. The -U forces Maven to download no matter what your repository update policies are. Add -X to get detailed debug logging.
  5. Copy settings.xml from MAVEN_HOME\conf\ to USER_HOME.m2. Add proxies (if needed) in case you are behind a proxy server.

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


It appears that there can be a lot of different causes for this issue. I experienced it after installing a new version of Eclipse (Luna). Command-line maven worked fine, but Eclipse had build issues.

I use a Certificate Authority in my JRE. This is important because this provides my authentication when downloading Maven resources. Even though my project was pointing to the appropriate JRE inside of Eclipse - Eclipse was running using a different JRE (this is apparent looking at the Java process properties in Windows task manager). My solution was to add the following in my eclipse.ini and explicitly define the JRE I want to use.

-vm
C:\Program Files\Java\jdk1.7.0_51\bin\javaw.exe 

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


Follow easy steps to resolved the below issue: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact description for org.apache.maven.plugins:maven-ar-plugin:ar:2.4 in eclipse

enter image description here

Solution: Step1: enter image description here

Step2:

enter image description here

Issue solved ?

enter image description here


Hopefully I'm not late for the party.

Encountered this using Eclipse Kepler and Maven 3.1.

The solution is to use a JDK and not a JRE for your Eclipse project. Make sure to try maven clean and test from eclipse just to download missing jars.


In addition to what @JackDev replies, what also solved my problem was to

1) Install the jdk under directory with no spaces:

C:/Java

Instead of

C:/Program Files/Java

This is a known issue in Windows. I fixed JAVA_HOME as well

2) Install maven as in Java case, under C:/Maven. Fixed the M2_HOME accordingly.

3) I java 7 and java 8 on my laptop. So I defined the jvm using eclipse.ini. This is not a mandatory step if you don't have -vm entry in your eclipse.ini. I updated:

C:/Java/jdk1.7.0_79/jre/bin/javaw.exe

Instead of:

C:/Java/jdk1.7.0_79/bin/javaw.exe

Good luck


his issue is happening due to change of protocol from http to https for central repository. please refer following link for more details. https://support.sonatype.com/hc/en-us/articles/360041287334-Central-501-HTTPS-Required 

In order to fix the problem, copy following into your pom.ml file. This will set the repository url to use https.

<repositories>
        <repository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>central</id>
            <name>Central Repository</name>
            <url>https://repo.maven.apache.org/maven2</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <releases>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>central</id>
            <name>Central Repository</name>
            <url>https://repo.maven.apache.org/maven2</url>
        </pluginRepository>
    </pluginRepositories>

Try to delete all dirs in /usr/share/maven-repo - of course then maven will die so you must re-install and try again. In my case re-install from maven ver.3. to maven2 with deleting all repositories helped.

I tried by deleting all from .m2 but that didn't help.


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.


I had the same problem but with an other cause. The solution was to deactivate Avira Browser Protection (in german Browser-Schutz). I took the solusion from m2e cannot transfer metadata from nexus, but maven command line can. It can be activated again ones maven has the needed plugin.


In my case I'm using an external maven installation with m2e. I've added my proxy settings to the external maven installation's settings.xml file. These settings haven't been used by m2e even after I've set the external maven installation as default maven installation.

To solve the problem I've configured the global maven settings file within eclipse to be the settings.xml file from my external maven installation.

Now eclipse can download the required artifacts.


What I found out is that while m2e is looking for v2.5 by default, my local repo has 2.6 and no 2.5.

Without going into investigation of how this came about simply adding the dependency to pom solved the problem

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

This can be removed after running a build once


Most people will tell you to check your proxy settings or delete and re-add artifacts, but I will stay away from that and give another suggestion in case that doesn't turn out to be your problem. It could be your mirror settings.

If you use maven at the office then there's a good chance maven is configured to look for your company's internal maven repository. If you're doing some work from home and you are not connected to the network this could be the problem. An obvious solution might be VPN to the office to get visibility to this repo. Another way around this is to add another mirror site to your /User/.m2/settings.xml file so if it fails to find it on your office network it will try public repo.

<mirror>
    <id>Central</id>
    <url>http://repo1.maven.org/maven2</url>
    <mirrorOf>central</mirrorOf>
    <!-- United States, St. Louis-->
</mirror>

For other maven repositories take a look here: http://docs.codehaus.org/display/MAVENUSER/Mirrors+Repositories


I was getting the same issue.

I just installed the m2e (Maven2Eclipse)plugin from below site:

http://www.eclipse.org/m2e/

Eclipse>Help>Install New Software>Available Software Sites>Add

Name: m2e (any name is OK)
Location:m2e - http://download.eclipse.org/technology/m2e/releases/

Under Install Window> Work with:

Select this new location and Add all the plugins that appear. Eclipse restart and it was running properly with no previous errors.


Try downloading a different version of maven. I had the same problem with maven 3.5.2 , I solved my problem just downloading maven 3.0.4


If your working at a company, they may be preventing you from downloading outside software and installing it. You may need to install the plugins manually or repoint to an internal mirror repository.


After entering your proxy settings in settings.xml

<proxies>
<!-- proxy 
 | Specification for one proxy, to be used in connecting to the network.
 |  -->
<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <username>DOMAIN\YOURID</username>
  <password>123456</password>
  <host>proxy.company.com</host>
  <port>8080</port>
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>

</proxies>

Check whether the below tag is having the value false in settings.xml

<offline>false</offline>

This helped me.


Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to eclipse

How do I get the command-line for an Eclipse run configuration? My eclipse won't open, i download the bundle pack it keeps saying error log strange error in my Animation Drawable How to uninstall Eclipse? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Class has been compiled by a more recent version of the Java Environment Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9 "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat

Examples related to maven

Maven dependencies are failing with a 501 error Why am I getting Unknown error in line 1 of pom.xml? Why am I getting "Received fatal alert: protocol_version" or "peer not authenticated" from Maven Central? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Unable to compile simple Java 10 / Java 11 project with Maven ERROR Source option 1.5 is no longer supported. Use 1.6 or later 'react-scripts' is not recognized as an internal or external command How to create a Java / Maven project that works in Visual Studio Code? "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository Java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException

Examples related to jakarta-ee

Java 11 package javax.xml.bind does not exist javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files Deploying Maven project throws java.util.zip.ZipException: invalid LOC header (bad signature) web.xml is missing and <failOnMissingWebXml> is set to true WELD-001408: Unsatisfied dependencies for type Customer with qualifiers @Default Name [jdbc/mydb] is not bound in this Context An internal error occurred during: "Updating Maven Project". java.lang.NullPointerException How to consume a SOAP web service in Java java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer

Examples related to m2eclipse

web.xml is missing and <failOnMissingWebXml> is set to true How to solve maven 2.6 resource plugin dependency? No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? An internal error occurred during: "Updating Maven Project". java.lang.NullPointerException An internal error occurred during: "Updating Maven Project". Unsupported IClasspathEntry kind=4 Maven "build path specifies execution environment J2SE-1.5", even though I changed it to 1.7 Failed to resolve version for org.apache.maven.archetypes Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved How to deal with missing src/test/java source folder in Android/Maven project? SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". error