I decided to clone my base project (basic service) to start a new project, so I used git to fetch it to my local drive, then tried to import to my workspace using file->import->maven->existing maven projects. Picked my new cloned project, and indeed the POM.xml file appeared, but the checkbox next to it was unclickable! Of course eclipse won’t tell you why, so after searching the web and trial and error, I finally figured it out:
If you already have a project by the name specified in the POM, you can’t create a new one with that name from the POM.xml
In order to get through this issue, you need to add a suffix in the Advanced->Name template field (just adding “clone” was enough for me) or change it in the POM.
This happened to me today: I added google Guava to my pom (for using their ImmutableSet collection), maven imported the jar correctly, but for some reason Eclipse refused to show it in the maven dependencies list, and the ImmutableSet import did not work (would not show me the option to add a java import statement, and adding it manually did not find the google library).
The reason for this eludes me, so can’t solve the bug, but I do know a quick work around:
- close Eclipse
- go to the project directory
- in terminal, enter:
- do NOT run mvn eclipse:eclipse as this will create an eclipse project which has a weird structure in eclipse, instead, do the following:
- re-run eclipse, go to file->import, select maven->existing maven project, choose your project directory, eclipse should recognize your pom, click finish, and voilla, your project will start working again.
This will probably work for any unclear state the project goes into in eclipse, not just import issues.