The answer for this is in this FAQ:
http://m2eclipse.sonatype.org/m2eclipse-faq.html#7

Here's the entry:


        Why generated source folders are not added to classpath

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.

-Marshall



On 4/16/2010 8:43 AM, Marshall Schor wrote:
> I did a (maven) checkout of one of the maven plugins (to see how it
> worked) and it failed to build.  I tried building it from the
> commandline and it worked fine; a refresh in eclipse on the project
> showed no errors.
>
> But when I opened one of the of the source files, there were compile
> errors showing in it.
>
> Cause: the maven build generated some sources in target/generated-sources. 
>
> Fix: go to those sources and right click -> Build Path -> use as source
> folder.
>
> Several of our sandbox projects have generated sources, for things like
> XMLBeans.
>
> I've posted a query about this in the m2eclipse users list.
>
> -Marshall
>
>
>   

Reply via email to