413

I have imported maven project in STS, when I run update update project I receive:

"Updating Maven Project". Unsupported IClasspathEntry kind=4

Is there a workaround for this?

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
user810430
  • 11,181
  • 15
  • 38
  • 43
  • Does a build on command line work ? Which Maven version? – khmarbaise May 12 '12 at 18:30
  • I have the same issue and i am not able to slove by this answer can you please see http://stackoverflow.com/questions/12049566/an-internal-error-occurred-during-enabling-maven-dependency-management-unsup – Hemant Metalia Aug 21 '12 at 07:21

15 Answers15

615

This issue has been fixed in m2e 1.5.0 which is available for Eclipse Kepler (4.3) and Luna (4.4)

Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=374332#c14

The problem is caused by the fact that STS (the Spring IDE/Eclipse), as well Eclipse and other Eclipse based IDE's, use the m2e(clipse) plugin but that eclipse:eclipse has been probably been run on the project. When m2e encounters a "var" .classpath entry, it throws this error.

The update sites are specified at the following url:
http://eclipse.org/m2e/m2e-downloads.html

If you can't use m2e 1.5.0 for any reason, then :

  1. Disable the maven nature for the project (via the right-click menu)

  2. Run mvn eclipse:clean (while your project is open in STS/eclipse). Depending on the timing, you might need to do a refresh or two on the project before re-enabling the maven nature. You should be able to see that your project has lost it's Maven nature. (The eclipse:clean goal just deletes the .project, .classpath and .settings/ files/directories. You can also just remove those files (again while the project is open) instead of running mvn eclipse:clean.)

  3. Re-enable the maven nature.
    (Most of the time, this can be done by right-clicking on the project in question in the package explorer pane, and then choosing 'Configure'-> 'Convert to Maven Project')

Afshin Moazami
  • 2,092
  • 5
  • 33
  • 55
Marco
  • 8,958
  • 1
  • 36
  • 56
  • 3
    I had to try this twice to get it to work. The first time I tried it the "var" crept back into the .classpath file. I regenerated the files with mvn eclipse:eclipse and tried again. It worked the 2nd time. – Deepak Bala Aug 01 '12 at 18:19
  • 1
    It might help to remove manually from the .classpath file all the `classpathentry` with the `kind` attribute set to `var`. – Puigcerber Aug 21 '12 at 09:29
  • In the answer above: Disable the maven nature for the project (via the right-click menu), run mvn eclipse:clean (while your project is open in STS/eclipse), and then re-enable the maven nature. This worked quite well for me. Thanks for Posting! Eric – Eric Manley Aug 24 '12 at 15:48
  • 31
    It worked for me, but I had to do an extra "Refresh" before re-enabling the Maven nature (actually in my case "Configure as Maven Project" as it was a faceted project) – Stuart Watt Aug 28 '12 at 19:14
  • 2
    https://repository.sonatype.org/content/repositories/forge-sites/m2e/ doesn't work anymore – Shervin Asgari Aug 31 '12 at 09:03
  • Thank you SO MUCH for this answer. I actually had to follow these directions a couple of times. Also, a consequence of running mvn eclipse:eclipse the first time around is that it put all my maven dependencies at the root of the project instead of under the folder Maven dependencies. Following your instructions resolved that issue as well. – Lolo Sep 28 '12 at 19:14
  • 'mvn eclipse:clean' will remove eclipse-nature previously added with eclipse:eclipse. after that let m2e do the work. – AChoice Oct 11 '12 at 15:11
  • For anyone experiencing this problem with Hadoop, the downside of letting m2e do all the work is that generated source folders aren't recognized. You must manually add as source folders any `java`/`proto`/`avro` folders under `target/generated-sources` or `generated-test-sources`. Right click > Build Path > Use as Source Folder. – Trevor Robinson Oct 26 '12 at 19:23
  • I cannot disable the maven nature. There is no response. I've tried lots and lots of things, but I keep going around in circles. – Marc Dec 23 '12 at 17:47
  • @Marc: otherwise, you can simply delete the project from eclipse (but not the files), run mvn eclipse:clean and then reopen the project and (re)add the project by "creating" a new project with the same name as the old project. – Marco Dec 25 '12 at 23:06
  • As an aside, I had to completely re-import all of my projects after I had removed the maven nature. The re-enable did not show up then. But this fixed my problems. Thanks much. – Gray Jan 14 '13 at 20:35
  • Before doing an extra "Refresh" as Stuart Watt said I also had to remove the .settings folder. – Adrian Ber Sep 28 '13 at 21:12
  • 2
    I think you go the Eclipse versions wrong: Eclipse Kepler is 4.3 and Luna is 4.4 – vogella Jul 09 '14 at 04:48
  • Are you sure m2e 1.5.0 is compatible with Kepler? I needed to upgrade to Luna before updating to 1.5.0. – Murat Aug 12 '14 at 14:53
  • This worked fine for me, but I had to do 1 more thing. Right click project -> Properties -> Deployment Properties -> Add Java Build Path Entries -> Select all filies -> Apply. And its done! – Badal Sep 09 '14 at 05:52
63
  1. Right-click on your project, select Maven -> Remove Maven Nature.

  2. Open you terminal, go to your project folder and do mvn eclipse:clean

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

Now you got “Unsupported IClasspathEntry kind=4 Eclipse Scala” disappear.

Johan
  • 74,508
  • 24
  • 191
  • 319
Sagar
  • 631
  • 5
  • 2
  • 5
    Thanks for this. Just a note for others, it's `mvn eclipse:clean`, not `mvn clean` (I got fooled by not paying close attention). – Jin Kim Nov 05 '12 at 16:30
  • Ok. I have created src/java from cmd line, after importing project into Kepler. That was the case. – Zbyszek Aug 17 '13 at 17:28
45

Sometimes, even re-importing the Maven project will not work. Updating the project correctly in eclipse is not a deterministic process. The only 100% fail safe procedure I've found is:

  1. Disable Maven Nature, run mvn eclipse:clean, restart, cross your fingers and Pray 3 times.
  2. If this won't work, delete the project, run mvn eclipse:clean, re-import refresh, pray and use the force.
  3. If this still doesn't work, restart Eclipse, or even better your computer. While waiting for the reboot, you can make a random donation to fix your Karma. Repeat step 2 and don't forget to pray and control your anger. Anger leads to hate. Hate leads to suffering.
  4. Try all the other answers posted in this thread. You might need to try them all for 3 times at least before giving up.
  5. Format your Computer, re-install Eclipse and Maven. No need to pray anymore, all gods hate you anyway
  6. Delete your git project, burn the physical drive that stored the remote repository, and write your project from scratch.
  7. Find a time machine, travel to the past and convince yourself to follow another, non-programming career or at least to avoid Java
yannicuLar
  • 3,083
  • 3
  • 32
  • 50
12
  1. Make sure that the version of the m2e(clipse) plugin that you're running is at least 1.1.0

  2. Close maven project - right click "Close Project"

  3. Manualy remove all classpathentry with kind="var" in .classpath file
  4. Open project

or

  1. Remove maven project
  2. Manualy rmeove .classpath 4 Reimport project
hicolour
  • 784
  • 5
  • 11
  • The error isn't with STS as stated by @Marco. It is a general m2e problem. Disable the Maven nature, delete the .classpath file, re-enable the Maven nature. – sbzoom Aug 22 '12 at 15:01
6

Have you tried:

  1. If you have import project into the eclipse 4, please delete it.
  2. In maven consol, run: mvn eclipse:clean
  3. In Eclipse 4: File -> Import -> Maven -> Existing Maven Projects
j0k
  • 22,600
  • 28
  • 79
  • 90
Tam
  • 61
  • 1
  • 1
3

Seeing all other answers. I found for me a simpler way.

I just removed all lines in the .classpath (editing with eclipse) containing a var and used maven -> update project without an error.

keiki
  • 3,260
  • 3
  • 30
  • 38
2

This error is also thrown if the update command is used on a project instrumented for code coverage with Clover.

To resolve in this scenario: Un-instrument the project folders you wish to update. Run the maven update then instrument for code coverage again.

Andreis
  • 21
  • 1
0

I tried Marco's steps but no luck. Instead if you just get the latest m2e plugin from the link he provides and one by one right click on each project -> Maven -> Update Dependencies the error still pops up but the issue is resolved. That is to say the warnings disappear in the Markers view. I encountered this issue after importing some projects into SpringSource Tool Suite (STS). When I returned to my Eclipse Juno installation the warnings were displaying. Seeing that I had m2e 1.1 already installed I tried Marco's steps to no avail. Getting the latest version fixed it however.

  • 1
    Thanks, edited my answer to emphasize that you should get the latest version, not just 1.1.0 which was at the time the latest version. – Marco Aug 02 '12 at 23:52
  • If you use the Eclipse MarketPlace instead of downloading via an external site, you will always get the latest version. – Jops Mar 30 '13 at 12:10
0

I couldn't get mvn eclipse:clean etc to work with Kepler.

However I changed creating and extending variables to just using external jars in my eclipse classpath. This was reflected in no var's in my .classpath.

This corrected the problem. I was able to do a Maven update.

user1069528
  • 618
  • 1
  • 13
  • 29
0

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
  • The firts link yields "We're sorry, the page or file cannot be found. Here are some reasons why..." – Jaroslav Záruba Jun 28 '14 at 14:16
  • Reason #1 applies here : This is an Eclipse Update site/p2 repository; you must access it from Eclipse (see http://help.eclipse.org/luna/index.jsp?topic=//org.eclipse.platform.doc.user/tasks/tasks-127.htm). – Fred Bricon Jun 30 '14 at 12:49
0

Upgrading from Kepler to Luna worked for me.

I had just added some components for Java 1.8 support. It seems that they where not as compatible as I would like or that I mixed the wrong ones. It really caused a lot of problems. Trying to update the system reported errors as they couldn't fulfill some dependencies. Maven upgrades didn't work. Tried a lot of things.

So, if there is no reason to avoid the upgrade just add the luna repository to avalilable software sites (Luna http://download.eclipse.org/releases/luna/ ) and "check for updates". It is better to have all the components with the same version and there are some nice new features.

borjab
  • 11,149
  • 6
  • 71
  • 98
0

I tried all the steps mentioned here and on similar questions but couldn't solve this problem. I could neither solve problem nor update my m2eclipse. So I installed Eclipse Luna and it solved my problem... though it mean that I had to spend about 45 min to configure all the environment in my workspace.

Kanad
  • 1,008
  • 1
  • 11
  • 14
0

Try mvn clean install eclipse:eclipse -Dwtpversion=2.0 command on DOS command prompt. Suggesting you because , It worked for me!!

Bharat
  • 121
  • 1
  • 4
0

I'm using Eclipse 4.3.2 (Kepler) with M2E 1.4.x and felt over this problem several times!

In my case the "mvn eclipse:eclipse" command also generates Checkstyle, PMD and Findbugs configuration so "mvn eclipse:clean" does not help me because it drops all those config files again.

The best solution for me was to delete all ".classpath" files:

find . -name ".classpath" -delete

and import the project into eclipse afterwards.

TekTimmy
  • 3,066
  • 2
  • 29
  • 33
0

Before importing the project, it should be converted into eclipse project mvn eclipse: eclipse Then i found the following error. An internal error occurred during: "Importing Maven projects".Unsupported IClasspathEntry kind=4

Where is the value kind = "var" that M2E does not recognize and therefore throws the error.

Now type this. mvn eclipse: clean

Now refresh the project in eclipse or re-import.

Supun Dharmarathne
  • 1,138
  • 1
  • 10
  • 19