Archive

Posts Tagged ‘import’

Another one of those irritating “you can’t do this but I won’t tell you why” in eclipse

November 4, 2012 Leave a comment

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.

HTH

Advertisements

Eclipse quirks #1 – sometimes the project just stops doing what it should

October 17, 2012 1 comment

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:

  1. close Eclipse
  2. go to the project directory
  3. in terminal, enter:
    mvn eclipse:clean
  4. do NOT run mvn eclipse:eclipse as this will create an eclipse project which has a weird structure in eclipse, instead, do the following:
  5. 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.