Question

I have started looking into Maven and wish to build a project from scratch and start writing new classes.

What do I need to do to make eclipse's auto compilation work under a Maven project in the same way as it does in a normal eclipse project?

Here is the problem I am facing:

I have created a new project in eclipse with the m2e plugin.

I am using the quickstart archetype, which generates a simple project structure with a main folder and a test folder. Initially the main folder contains a java file called App.java (under the package specified during setup).

Now I add a new class in the same package as App.java, say "Other" in the file Other.java, add a public constant to it, and open up App.java for editing. When I try to reference the class Other, eclipse does not recognise it.

I have run Maven compile via eclipse and double checked that the build path output folders are correct, but everything is as it should be.

I have searched through countless tutorials on Maven and Eclipse, but all the ones I have found only talk about setting up the project, not about actually developing under a Maven project.

My Eclipse is standard edition Kepler, and I am using eclipse's embedded maven installation.

Was it helpful?

Solution

It seems my workspace may have been corrupted.

I did the following things, one of which will have made the difference.

  1. Delete workspace .metadata folder
  2. Set up eclipse to use separate installation of Maven.
  3. Create new Maven project with m2e, specifying the location of the project to be different from workspace, e.g. /dev/maven/
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top