views:

25

answers:

1

I've got project with a few sub modules.

mvn clean install

works absolutely fine. But in Eclipse with the parent project open none of the maven dependencies are available and so all my Java source files are full of indicated compilation errors (they're not listed in the build path for the project). If I open one of the sub modules as a project there are no indicated compilation problems.

I've tried running

mvn clean install eclipse:clean eclipse:m2eclipsemvn clean install eclipse:clean eclipse:m2eclipse

and choosing project / update maven dependencies. Refreshing, closing and opening the project and Eclipse, etc.

Any ideas? Thanks in advance.

+1  A: 

Getting m2eclipse to match maven's classpath

Just use Import... > Existing Maven Projects and import your multi-modules Maven project, that's all.

But in Eclipse with the parent project open none of the maven dependencies are available and so all my Java source files are full of indicated compilation errors (they're not listed in the build path for the project).

A parent project (i.e. with a pom packaging) is not a Java project, it's just there as a facility to make editing the parent pom.xml from the IDE possible (and that's already nice, importing nested projects inside Eclipse was initially not even possible).

If I open one of the sub modules as a project there are no indicated compilation problems.

That's how you are supposed to do things.

I've tried running (...)

You are not supposed to use the Maven Eclipse Plugin when using m2eclipse and this is not supported. Either use one or the other. If you decide to use m2eclipse, use Import... > Existing Maven Projects as suggested.

Pascal Thivent
That's a shame, but it clears a few things up for me, so thanks.
rich