Importing Maven Project from a Cloned Git Project into Eclipse Juno SR2 with m2e

I was having some funky issues with Eclipse and m2e not properly reading the pom.xml and setting up the .classpath properly when importing an existing Maven project into Eclipse from a cloned git repo.

When I did the following:

  • Go to File/Import/Maven/Existing Maven Projects
  • Chose the root dir of the the existing directory

I got the following error:

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

Initially, I solved it with a series of back-and-forth commands in both Eclipse and on the commandline to finally satisfy Eclipse that the dependencies were satisfied.

Thanks to the help of a friend I found a much easier process which enables me to cleanly clone, and import into Eclipse.

  • Clone your git repo
  • On the command-line in the same directory into which you cloned your source run:
    • $ mvn eclipse:eclipse; mvn eclipse:clean
  • Open Eclipse
  • Select File/Import/Maven/Existing Maven Projects
  • Browse to the directory into which you cloned your source and select that directory
  • Click ‘Finish’ in the dialog box

You should now have your project in Eclipse without any compile/dependency errors.

Leave a Reply