67

As the title mentioned I have the following problem: I use Eclipse with Maven Nature and when I update my Maven Project, I get this error:

An internal error occurred during: "Updating Maven Project".
Unsupported IClasspathEntry kind=4

The solution that always comes back is the following:

  • rightclick project, remove maven nature
  • mvn eclipse:clean (with project open in eclipse/STS)
  • (sometimes they suggest to do mvn eclipse:eclipse next)
  • rightclick project and reenable maven nature

Now I exhaustively tried all combinations several times. But I always keep getting the above error. The error starting occurring when I had to mvn eclipse:eclipse the project. Before it was always running fine using only m2eclipse features and setting everything in eclipse.

sudo bangbang
  • 27,127
  • 11
  • 75
  • 77
Vjeetje
  • 5,314
  • 5
  • 35
  • 57
  • What Eclipse version are you using? Have you identified the suspicious classpath entry in the `.classpath` file? How does it look like? Maybe it is added by some Eclipse plugin. – SpaceTrucker Feb 25 '13 at 12:31
  • I'm using Eclipse SDK,Version: 4.2.1,Build id: M20120914-1800, doesn't the .classpath file get deleted by mvn eclipse:clean? I added the .classpath file in the original post. – Vjeetje Feb 25 '13 at 12:38

13 Answers13

152

I had to do it slightly different to work for me:

  1. rightclick project, remove maven nature (or in newer eclipse, "Maven->Disable Maven Nature")
  2. mvn eclipse:clean (with project open in eclipse/STS)
  3. delete the project in eclipse (but do not delete the sources)
  4. Import existing Maven project
karl li
  • 1,316
  • 15
  • 19
Vjeetje
  • 5,314
  • 5
  • 35
  • 57
  • 7
    Not necessary to remove maven nature at all. – Aritz Jun 07 '13 at 06:27
  • 8
    Instead of 3 I deleted the .settings folder and refresh the project in Eclipse and instead of 4 I did Configure > Convert to Maven project. – Adrian Ber Sep 28 '13 at 21:16
  • Step 2 removed .classpath and .project even when the project was opened in Eclipse Juno. – slash33 Oct 17 '13 at 16:59
  • 2
    @JJZabkar Probably this will help: http://stackoverflow.com/questions/10564684/how-to-fix-error-updating-maven-project-unsupported-iclasspathentry-kind-4 – NikhilWanpal Oct 12 '14 at 06:20
86
  • I just went to Properties -> Java Build Path -> Libraries and removed the blue entries starting with M2_REPO.

  • After that, I could use Maven -> Update Project again

tharindu_DG
  • 8,900
  • 6
  • 52
  • 64
Wiebke
  • 1,006
  • 8
  • 13
9

This is all you need:

  1. Right-click on your project, select Maven -> Remove Maven Nature.

  2. Open you terminal, navgate to your project folder and run mvn eclipse:clean

  3. Right click on your Project and select Configure -> Convert into Maven Project

  4. Right click on your Project and select Maven -> Update Project

tharindu_DG
  • 8,900
  • 6
  • 52
  • 64
4

After trying all these procedures it still didn't work for me. What did work was

  1. go into File Explorer and delete the .classpath file under the project's root folder
  2. run Maven update within Eclipse, and check Force update of Snapshots/Releases

Our current work required integrating a number of disparate projects so unfortunately use of SNAPSHOTs in a production environment were required (taboo in Maven circles)!

mitunome
  • 51
  • 2
3

This issue (https://bugs.eclipse.org/394042) is fixed in m2e 1.5.0 which is available for Eclipse Kepler and Luna from this p2 repo :

http://download.eclipse.org/technology/m2e/releases/1.5

If you also use m2e-wtp, you'll need to install m2e-wtp 1.1.0 as well :

http://download.eclipse.org/m2e-wtp/releases/luna/1.1

Fred Bricon
  • 5,369
  • 1
  • 31
  • 45
2

Slightly different option usually works for me:

  1. "mvn eclipse:eclipse" for this project in the command line.
  2. "Refresh/F5" this project in eclipse.

That's all, no need to re-import but need to have the terminal window handy.

asilchenko
  • 81
  • 1
  • 3
2

I solved this by looking at this comment on JBIDE-11655 : deleting all .project, .settings and .classpath in my projects folder.

Helio Bentzen
  • 645
  • 2
  • 12
  • 24
2

I imported the project as general project from git repository.

  • Deleted .settings, .project and .classpath in project's folder
  • Configure -> Convert to Maven Project. Only this solved the problem in my case.
tharindu_DG
  • 8,900
  • 6
  • 52
  • 64
aan
  • 21
  • 3
2

I have that problem and my solution is going source folder and run command line: mvn clean install -DskipTests eclipse:eclipse then return eclipse workspace and refresh project. Hope that help!

QuangHao
  • 21
  • 1
2

Your command line mvn eclipse project generator may not be the same version as that of your eclipse, and eclipse doesn't understand for your command line tool is generating. Just use eclipse's in this case:

  • remove the project from eclipse (including all modules if multi-module)
  • run: rm -rf .settings/ .project .classpath to delete eclipse project files, also from modules
  • import your project as an existing maven project
eadjei
  • 2,066
  • 2
  • 14
  • 7
1

I removed my .classpath file in my project directory to correct this issue. No need to remove the Maven Nature from the project in Eclipse.

The specific error I was getting was: Project 'my-project-name' is missing required Java project: 'org.some.package-9.3.0 But my project wasn't dependent on org.some.package in any way.

Perhaps an old version of the project relied on it and Maven wasn't properly updating the .classpath file.

tharindu_DG
  • 8,900
  • 6
  • 52
  • 64
fwc
  • 103
  • 2
0

It helped in my case

rightclick project, remove maven nature mvn eclipse:clean (with project open in eclipse/STS) delete the project in eclipse (but do not delete the sources) Import existing Maven project

samayo
  • 16,163
  • 12
  • 91
  • 106
0

My tricky solution is:

  1. Open your windows Task Manager,
  2. Find the Javaw.exe process and highlight it, then End it by End Process
  3. In eclipse project browser, right click it and use Maven -> Update Project again.

Issue is resolved.

If you have Tomcat Server Running in Eclipse, you need to refresh project before restart Tomcat Server.

tharindu_DG
  • 8,900
  • 6
  • 52
  • 64
Richard
  • 2,080
  • 18
  • 17