Eclipse - Importing an existing Maven project gives Unsupported IClasspathEntry kind=4 Error

10,407

Solution 1

I finally managed to resolve the reported errors. This is what I followed:

1) My eclipse was 64-bit version, but it was run using a 32-bit JVM. I changed eclipse.ini to use 64-bit JVM.

2) Deleted the project from my workspace.

3) Cleaned eclipse project files using mvn eclipse:clean. And created the project files again using mvn eclipse:eclipse

4) Imported the project as General > Existing project in eclipse

5) Built the project

This time, there were no errors reported for Unsupported IClasspathEntry kind=4. I hope, it helps others facing the same problem. Beware of Eclipse's 32-bit / 64-bit JVM. Prefer to use the same architecture as eclipse - i.e. use 64-bit JVM if your eclipse is 64-bit.

Solution 2

Right-click on your project, select Maven -> Remove Maven Nature. Open you terminal, go to your project folder and do “mvn eclipse:clean” Right click on your Project and select “Configure -> Convert into Maven Project”

Solution 3

For me the best sollution was to clear up the directory from hidden files (I don't know how this structure looks like on Windows OS).

  1. Remove all hidden files from your project structure
  2. Be happy
Share:
10,407
Pat
Author by

Pat

An OO enthusiast and Java developer, keen on doing the right things the right way.

Updated on June 13, 2022

Comments

  • Pat
    Pat almost 2 years

    I have an existing Maven project with correct pom.xml file. I am able to build the project from command line mvn install. However, when I import the project as existing Maven Project in eclipse, I get Unsupported IClasspathEntry kind=4 error in eclipse.

    Further, some of the project's properties are not correctly reflected after the import - E.g. it is a web project, but I do not see Deployed Resources under the project structure. I can still see that little M on the project icon indicating that it is a maven project.

    I tried updating the project with Alt+F5 and refreshed it with F5 as well. Still the same error.

    I also tried the approach mentioned on this SO post

    How to fix error "Updating Maven Project". Unsupported IClasspathEntry kind=4?

    • i.e. Disable maven nature, eclipse:clean, re-enable maven nature. Still the same error when I enable maven nature.

    Eclipse also shows an error in my pom.xml, but mvn install works fine from cmd line.

    Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.5:copy-resources (default-cli)
    

    I am not sure if these 2 errors are related or not.

    My setup:

    • Windows 7 Pro (64 bit)
    • JDK 1.6.0_31 (32 bit)
    • Eclipse Juno 4.2
    • Maven 3.0.5
    • m2e 1.4.0