Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import maven project in eclipse - folder structure not as expected

I am new to maven projects. Steps followed :

  1. I tried importing a maven project in eclipse through File -> Import.
  2. Gave the location of root dir of the svn checkout project. It recognized the pom.xml file.
  3. Clicked Finish. Project imported and all files were placed in the Project Explorer of the eclipse.

Problem:

The directory structure was not as that of a java package, it was just a normal folder structure. I am not able to browse the code quickly i.e. get the declaration, different calls to a method and all the code browsing shortcuts. It gives a error says.. Project not in Build Path. On right clicking the project, there are no options present in the 'Build Path'.

Please let me know, what I am doing wrong here. How to import a maven project correctly into eclipse and set it up ?

like image 650
mtk Avatar asked Oct 29 '12 09:10

mtk


4 Answers

Run :

mvn eclipse:clean

Then

mvn eclipse:eclipse

And it should be it's old self again, if not refresh the project in eclipse and that should do it

like image 196
ant Avatar answered Oct 18 '22 03:10

ant


I have faced similar issue . I have resolved this issue :

Right click on project -> properties -> Project Facets -> convert it into Facet form

And you can get the folder structure as you want

like image 29
Vedprakash Panda Avatar answered Oct 18 '22 03:10

Vedprakash Panda


I faced the same issue and could resolve by following steps

  1. First ensure that you are able to maven clean or install. Just to ensure the proj setup works.
  2. Right click on Project.
  3. Navigate to Maven > Update project configuration.

This should resolve the issue. Hope this helps.

like image 26
arunky Avatar answered Oct 18 '22 05:10

arunky


I resolved this issue with:

  1. go to Window > Preferences > build path
  2. under output and source folder choose the project
  3. delete/backup original project and create/import the same.

your issue will be resolved.

like image 1
swapnil thange Avatar answered Oct 18 '22 05:10

swapnil thange