Question

I am trying to import a maven project (import->existing maven project) into eclipse and it is showing up in eclipse using the generic java project structure as opposed to the maven one. I have tried several versions of the m2e connection and all have the same problem. So for example instead of the following folders/packages/files I have:

src/
    main.java.my.package.name
          myfile.java
    test.java.my.package.name
          testfile.java

etc.

instead of the maven project structure

 src/main/java
         my.package.name
                myfile.java

etc.

Any assistance appreciated, thanks!

Was it helpful?

Solution

For the sake of completeness:

This happens sometimes due to a race condition in eclipse.

As you already found out: if it happens, it happens only once, on initial import. So your way was almost correct:

  • Remove all source paths
  • do not add them manually
  • instead, right-click on the project and select "Maven -> Update project" and accept the default settings. Now the source paths will be set correctly

OTHER TIPS

Woops, right after posting I was able to get it to work.

I had to go to project -> build path -> Source and remove the src/ folder and add the src/main/java, src/main/resources, etc. folders and it all works now.

Thanks for looking y'all!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top