Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How can a Maven Project become a Java Project ? (The project is a Maven one but it doesn't recognize Java at all (errors are not underlined, can't create Java files inside the project, ...).)
How can a Maven Project become a Java Project ? [message #769192] Wed, 21 December 2011 14:46 Go to next message
samuel.gmehlin is currently offline samuel.gmehlinFriend
Messages: 2
Registered: December 2011
Junior Member
Hi everyone,

I have a Maven project in Eclipse but it doesn't recognize anything linked to Java at all. For instance, when I write code and I make a mistake, it doesn't underline in red. Or when I want to do "New/Class" to add a Java file, well...I don't have this option anymore. Just "File"...

Does anybody know what I should do so that my Maven project can be also recognized as a "Java project" ?

Thank you in advance!
Re: How can a Maven Project become a Java Project ? [message #769336 is a reply to message #769192] Wed, 21 December 2011 20:45 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
You have to ensure that the Java file is in a source tree specified in the "Source" tab in the "Java Build Path" section of your project preferences.

I'm not sure how to interpret your statement about not having "New/Class" anymore. I don't know what you mean there.
Re: How can a Maven Project become a Java Project ? [message #769612 is a reply to message #769336] Thu, 22 December 2011 12:13 Go to previous messageGo to next message
samuel.gmehlin is currently offline samuel.gmehlinFriend
Messages: 2
Registered: December 2011
Junior Member
Thanks for your answer David.

Unfortunately, there is no "Java Build Path" in the project preferences. I know what you mean cos I can find it in a normal Java Project, but not in my current project.
By "new/class", i meant: in a Java project, when you want to create a new Class and add it to your project, you right click on your project in the project explorer, choose "New..." and then "Class". So in my project right now, there's no "Class" option in the "New..." menu.
Re: How can a Maven Project become a Java Project ? [message #769742 is a reply to message #769612] Thu, 22 December 2011 16:09 Go to previous message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
I had a feeling you would say that.

When I've been in a similar situation, it was time for some manual surgery on the ".project" file. If you have a Maven Java project that appears to be fine, then open up its ".project" file and compare it to the one with the problem. There will likely be "buildSpec" or "nature" elements in the good project that are not in the other. Simply copy those missing elements from the good one to the bad one. If you're not experienced with modifying this file, you should make a copy somewhere out of your workspace first. After you save the file, you should get closer to what you need.
Previous Topic:Cannot access Tomcat home page in Eclipse
Next Topic:How can I see the full error message?
Goto Forum:
  


Current Time: Thu Apr 25 03:35:30 GMT 2024

Powered by FUDForum. Page generated in 0.02857 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top