Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven: Eclipse not correctly configuring paths in a project with a parent pom

I have a maven project that I correctly build through the command line (mvn test). It is structured this way:

pom.xml
|-------subdir1/pom.xml
|-------subdir2/pom.xml
|-------subdir3/pom.xml

Inside each of the subprojects dir (subdir[1-3]), I have a structure of:

src/main/java
src/test/java

When I import the project to Eclipse, or update the maven configuration (Alt-F5), the srcdirs are incorrectly added to the BuildPath. I always need to manually remove them and add each one of the java dirs to have Eclipse correctly compiling.

How do configure my project so Eclipse will always correctly add the build paths?

like image 434
neves Avatar asked Mar 09 '23 04:03

neves


1 Answers

Ops, silly me. A colleague of mine added to the pom a spurious configuration:

<build>
    <sourceDirectory>src</sourceDirectory>

I just removed it from the configuration to use maven convention and everything worked fine. Thanks for the help.

like image 154
neves Avatar answered Apr 30 '23 08:04

neves