43
votes

I am trying to import maven project into eclipse 4.2 version.Its not importing the project properly. Its giving me error "Source folder is not a Java project" while I am trying to create a new call in it. Even ctrl+mouse click is also not working. I don't understand the problem. Even when I right click on project and select build path it shows me no action available. Anyone face the same issue

10

10 Answers

82
votes

In the maven project directory try

mvn eclipse:eclipse

that may do the trick.

51
votes

I ran into the same issue and fixed it by converting my project to faceted form.

Right click your project > Properties > Project Facets > Convert to Faceted Form, and select Java.

Java Project Facets

7
votes

I had the same problem... But you just need to update "source Folder" to correct source "src/main/java" from whatever mentioned in the pop up:

[Updating the Source Folder in Eclipse]

6
votes

Either turn your project into Eclipse project, using mvn eclipse:eclipse, or install Maven Integration for Eclipse plugins, like m2eclipse, and import project as a Maven project.

5
votes

for those who already see java selected, uncheck and check it again. select apply to override the existing setttings. finally it works !

Right click your project > Properties > Project Facets > Convert to Faceted Form, and select Java

4
votes

I got the same error in a slightly different context (Indigo with m2eclipse):

I imported a multi-module (1 jar module and 1 war module) maven project into Eclipse. Everything worked fine (clean, install OK) until I tried to add a new class to one of the modules and got the "Source Folder is not a Java project" error.

I solved this by opening the properties on the parent project and selecting the following Project Facets:
Java
Dynamic Web Module

This solved the problem. My guess is that, because the parent project for a multi-module project has pom packaging (<packaging>pom</packaging>), Eclipse doesn't know what kind of projects the parent project encloses (i.e. if the packaging were jar, it would know that it's a java project; if the packaging were war, it would know that it's a static or dynamic web module, etc.)

This is just my guess, but the fix worked for me, and it makes sense.

4
votes

Right click your project > Maven > Update Project

This step will add your project so the issue resolves easily.

3
votes

mvn eclipse:eclipse will resolve this problem. convert to maven project.

1
votes

I had this error because I tried to create a new Project by doing "Ctrl+N", typing "Project" on the Wizard's input label and then just pushing "Enter" until it was created. I solved this by typing "Java Project" instead of just "Project". You can also create a JAVA PROJECT by going to File > New > Java Project.

0
votes

open cmd and run the following command in the folder of your project-

mvn eclipse:eclipse

This did the trick for me