Problems importing multiple maven 2 projects into an eclipse workspace

I was wondering, someone experienced the same problem as me and can help me. I have a maven project that contains 6 modules. Some modules are interdependent. The project is written in Java and builds banks, wars and aars. I am trying to import it into Eclipse using the m2eclipse plugin. It seems to be working fine until the project is built. During the build process, I get hundreds of errors complaining about the lack of Java files that are generated. As I found out, eclipse cannot recognize that some of the generated packages should be interpreted as source code. I do not know what to do with this, since I spent a lot of time trying to solve this problem. The project builds with the command line. My goal is to debug the whole project on the Tomcat server, so I want to use eclipse,since it has pretty good integration with Tomcat.

Any help would be greatly appreciated.

Thank!

+3
source share
3 answers

As described in Why the generated source folders are not added to the path of the path class in the FAQ section:

Maven plugins used to generate source code from resources or other sources can register additional source folders to a Maven project at build time. Typically, such plugins are tied to technological resources (or process-test-resources) during the build phase (for example, jaxb, modello or xdoclet plugins). This means that in order to get these source folders for the generated sources, we must run the corresponding Maven build phase.

, , , m2eclipse Maven . Maven " > ... > Maven > " (, " ", ).

" Maven > , " -", , .

, , , maven .

+2

mvn eclipse:eclipse

, . maven, .

eclipse:eclipse .

Rembember, .

0

build-helper-maven-plugin ( ), Eclipse :

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.8</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>add-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>target/generated-sources/cxf</source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

pom , ...

0

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


All Articles