Maven: Eclipse incorrectly configures paths in project with parent pom

I have a maven project that I built correctly through the command line ( mvn test). It is structured as follows:

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

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

src/main/java
src/test/java

When I import a project into Eclipse or update the maven configuration (Alt-F5), the servers are srcincorrectly added to BuildPath. I always need to manually remove them and add each of the javadirs to compile Eclipse correctly.

How do I set up my project so that Eclipse always correctly adds build paths?

+4
source share
4 answers

, . pom :

<build>
    <sourceDirectory>src</sourceDirectory>

, maven, . .

+5

, eclipse maven, cmd mvn eclipse:clean mvn eclipse:eclipse, - > maven- > .

eclipse , .

+1

pom.xml : -

    <modules>
            <module>subdir1</module>
            <module>subdir2</module>
            <module>subdir3</module>
    </modules>

subdirX/pom.xml , . , :

    <parent>
            <groupId>your-parent-groupId</groupId>
            <artifactId>your-parent-artifactid</artifactId>
            <version>1.0</version>
    </parent>
0

You should check yours and see that it should not contain the src folder.

0
source

Source: https://habr.com/ru/post/1676168/


All Articles