views:

267

answers:

2

Hey, I was wondering if someone has experienced the same problem as me and can help me. I have a maven project which contains 6 modules. Some of modules are depending on each other. The project is written in Java and builds to jars, wars and aar. I've been trying to import it to Eclipse with the m2eclipse plug-in. It seems to work fine until the project builds. During the build process I get hundreds of errors complaining about missing Java files which are generated. As I found out eclipse can't recognize that some of generated packages should be interpreted as source code. I don't realy know what to do with it as I spent a lot of time already trying to solve this issue. The project is building fine with command line. My target is to debug the whole project on Tomcat server that's why I want to use eclipse as it has a pretty good integration with Tomcat.

Every help would be greatly appreciated.

Thank you!

+1  A: 

As documented in the Why generated source folders are not added to classpath entry of the FAQ:

Maven plugins used to generate source code from resources or other sources can register additional source folders to Maven project during the build. Usually such plugins are bound to process-resources (or process-test-resources) build phase (for example jaxb, modello or xdoclet plugins). This means that to get those source folders for generated sources, we have to run corresponding Maven build phase.

Not all projects using generated sources, so for performance reasons, m2eclipse does not run any Maven goals by default on project import. This can be changed in the Maven settings in "Window > Preferences... > Maven > Goals to run on project import" (e.g. you can specify "process-resources" build phase or specific plugins in that field).

Alternatively you can run "Maven > Update project configuration" action from the project popup menu, which is configured to run "process-resources" by default and it can be also changed on the same preference page.

So either add the goal to which the source generation process is bound to the list of goals to run on import or generate sources by running maven and update the project configuration.

Pascal Thivent
Thank you very much Pascal. Sorry, I didn't check it before.
Mike