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

I got the following error message when I tried to create a Maven project in eclipse. Many have posted about proxies in settings.xml file and also flush the .m2 folder forcing it to download a new one. None of this is working for me. I'm at work, with proxy settings active in the internet options.

The error message:

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 descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
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

POM.XML:

<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">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.blahhhhhhhhhhhhhhhhh</groupId>
  <artifactId>HelloRESTEasy</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</project>



settings.xml:

  <proxies>
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxyserver.company.com</host>
      <port>8080</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
  </proxies>

This question is related to maven eclipse-plugin

The answer is


In my case the error was: CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 ....

With eclipse luna from console in the pom.xml folder

mvn clean
mvn install

With Juno I had to had this to my pom.xml

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.3.2</version>
          <configuration>
            <!-- put your configurations here -->
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

And then

mvn install

And then from eclipse right click>maven>update project * Once the plugin is donwloaded you can remove the plugin from your pom.xml


Try cleaning the local .m2/repository/ folder manually using rm -rf and then re build the project. Worked for me after trying every possible other alternative(reinstalling eclipse, pointing to the correct maven version in eclipse, proxy settings etc)


I had this error, I follwed below three steps to solve,

1). check proxy settings in settings.xml refer,

2). .m2 diretory to release cached files causing problems

3) Point your eclipse to correct JDK installation. Refer No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? to know how


Right click project "pom.xml" in eclipse and select Maven Install. Right click on the Project -> Maven -> Update Project.

Then Refresh.


I also faced same problem... I follow the following steps...u can try it 1. Right click on maven project 2. Take cursor in Maven 3. Click on Update Maven project or (alt+F5). it will take some time then most probably problem will solved..


I had same issue while creating new spring project in eclipse using Maven.

The main reason for this issue is that the proxy settings was not there.

I used the following approach to reslove it:
1) create settings.xml with  the below content
    <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
                          https://maven.apache.org/xsd/settings-1.0.0.xsd">
      <localRepository/>
      <interactiveMode/>
      <usePluginRegistry/>
      <offline/>
      <pluginGroups/>
      <servers/>
      <mirrors/>
      <proxies>
        <proxy>
            <active>true</active>
            <protocol>http</protocol>
            <host>Your proxy</host>
            <port>Your port</port>
        </proxy>
      </proxies>
      <profiles/>
      <activeProfiles/>
    </settings>
2) Save the settings.xml file under local C:\Users\<<your user account>>\.m2
3) Then Right click project pom.XML in eclipse and select "Update Project". It always give precedence to settings.XML

I also faced the above error. I used Eclipse.

After followed the below solution, it works fine for me.

Solution is,

  1. Right click project "pom.xml" in eclipse and select Maven Install.
  2. Right click on the project -> Maven -> Update Project.
  3. Refresh

run:

mvn -U dependency:go-offline

It works for me.


I also had the same problem. I used next way:

1.Added settings.xml file (~/.m2/settings.xml) with next content

<proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>qq-proxya</host>
      <port>8080</port>
      <username>user</username>
      <password>passw</password>
      <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
    </proxy>
  </proxies>

3. Using cmd go to folder with my project and wrote mvn clean and after that mvn install !

  1. After that updated project in the Eclipse(Alt + F5) or right click on project -> Maven -> Update project

P.S. after that, when I add new dependency to my project I have to compile project using cmd(mvn compile). Because if I do it using eclipse plugin, I get error connecting with proxy connection.


For me, this problem occurs in Eclipse when the Maven installation is not well configured. By default the Maven installation is embedded in Eclipse. The .settings.xml file is set wherever the Eclipse installation points.

In my case this file was not auto-generated. I choose my own Maven installation - an external one. But if you don't explicitly choose where settings.xml is then Eclipse tries to get this file from the path set in the embedded installation. If the file is not autogenerated you have to choose the correct location.

Go to windows/preferences/Maven/Installation/user settings and choose the correct location of your settings.xml.


Whenever if you get this error please delete .m2 repository from local drive C:\Users\user and delete .m2 from there. The reason is this is existing repository used by different workspace so not allowing new application to create


Excellent i got solution:
Just clearing (.m2) complete folder and starting a new maven project problem solved for me.

Note:: .m2 folder located in os installed disk only.
If you want the exact location, check in Eclipse:
Eclipse-->window-->preferences-->maven-->user settings
There local repository path is for .m2
Delete entire .m2 folder and restart your eclipse.


Mainly this occurs during Eclipse upgrade.
I Solved using:

-> Right Click Project-> Maven->Update Project-> Select all (checkbox)

Old or out-dated, projects got refreshed with the updated jar files, and the required plugins. No more errors were visible.


Maybe your network is slow, so that jar isn't downloaded completely.

There are two methods:

a. find your .m2 folder, you can find some path like this 'org/apache/maven/plugins/maven-resources-plugin', you need only delete this foldler 'maven-resources-plugin', because others are downloaded well.

Then maven build your project.

If other problem occures, repeat this process again.

b. you can change a more quick maven source.

Firstly, you should find maven's settings file(window ->prefernces -> maven -> user settings). If it is empty, you can create a new one (any path, for example, .m2/settings).

Secondly, add sth like this (From https://blog.csdn.net/liangyihuai/article/details/57406870). This example uses aliyun's maven.

<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
                          https://maven.apache.org/xsd/settings-1.0.0.xsd">

      <mirrors>
        <mirror>  
            <id>alimaven</id>  
            <name>aliyun maven</name>  
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
            <mirrorOf>central</mirrorOf>          
        </mirror>  
      </mirrors>
</settings>

Thirdly, maven build again. (before this, you should delete your .m2 folder's files)


I have had this issue and I resolved it by following the next step:

1- Close Eclipse.

2- Go to user directory and delete the .m2 directory.

3- Open Elipse.

4- Right click on the project -> Run as -> maven install


There could be multiple reasons, i fixed with following steps:

  1. delete .m2 folder and re launch eclipse. (Find m2 folder in windows: c:\Users\Your_User_Name\ .m2 or to search in Mac : ~/.m2
  2. make sure settings.xml is configured as #JustinBieber mentioned.
  3. provide settings.xml path in eclipse (windows->preferences->maven->user settings) User Settings must locate settings.xml file.

save changes and relaunch the eclipse..!! it should work.


Jotting down some steps which help:

Writing answer from eclipse perspective as base logic will remain the same whether done by Intellij or command line

  1. Rt click your project -> Maven -> Update project -> Select Force update -> Click OK
  2. Under properties tag , add :
>  <maven.compiler.source>1.8</maven.compiler.source> 
> <maven.compiler.target>1.8</maven.compiler.target>
  1. In some instance , you will start seeing error as we tried force update , saying , failure to transfer X dependency from Y path , resolutions will not be reattempted , bla bla bla **In such case quickly fix it by cd to .m2/repository folder and run following command :

for /r %i in (*.lastUpdated) do del %i**


I was able to solve the same problem with different solution.

The solution that worked for me was to Right click project "pom.xml" in eclipse and select "Maven Install".


I have summarised what I did for my issue.

1) Delete .m2 folder. 2) Change the apache-maven-3.5.4\conf\settings.xml as follow

<proxies>
<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <host>proxyserver.company.com</host> --> Please change it according to your proxy
  <port>8080</port> -->Please change it accordingly
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>

3) Try again in cmd. It will work.

4) For eclipse, delete the existing maven project and go to

window ->prefernces -> maven -> user settings -> browse -> configure this path apache-maven-3.5.4\conf\settings.xml

5) Delete .m2 folder.

6) Restart the eclipse and try creating new maven project.

These steps worked for me.


I have had this issue, and removing the .m2/repository/ has not solved it in my case. Seems that eclipse is unable to download the maven-plugin or dependency needed. Therefore you need to install it yourself.

I have finally solved it downloading both jar and pom files from the Maven Repository and installing it using the command (better than copying to the folder directly): mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile> (In my case: mvn install:install-file -Dfile=maven-war-plugin-2.2.pom -DpomFile=maven-war-plugin-2.2.pom)