Bingo! That seems to have fixed it! Thanks a lot!

Hadn't spottet this - I inherited the pom's.

 

Michael

 

 

From: m2e-users-boun...@eclipse.org <m2e-users-boun...@eclipse.org> On Behalf 
Of Gayan Perera
Sent: Saturday, December 14, 2019 10:24 PM
To: michael.mo...@freesurf.ch; Maven Integration for Eclipse users mailing list 
<m2e-users@eclipse.org>
Subject: Re: [m2e-users] M2Eclipse not handling generated sources properly

 

You should remove "<goal>add-test-source</goal>" from your goal list.

 

On Sat, Dec 14, 2019 at 10:20 PM Michael Moser <michael.mo...@sunrise.ch 
<mailto:michael.mo...@sunrise.ch> > wrote:

Im my pom.xml there is a section re. generated resources (these are generated 
using the hibernate3-maven-plugin / v2.2).

        <plugin>

            <groupId>org.codehaus.mojo</groupId>

            <artifactId>build-helper-maven-plugin</artifactId>

            <version>1.7</version>

            <executions>

                <execution>

                    <id>add-source</id>

                    <phase>generate-sources</phase>

                    <goals>

                        <goal>add-source</goal>

                        <goal>add-test-source</goal>

                    </goals>

                    <configuration>

                        <sources>

                            <source>target/generated-sources</source>

                            <source>src/main/java</source>

                        </sources>

                    </configuration>

                </execution>

            </executions>

        </plugin>

In my understanding this should add "target/generated-sources" to the 
compilation source path, so that these files are also compiled and the 
generated class files end up in .../target/classes.

Now, after importing that project into Eclipse I find the below in the 
.classpath file:

<classpathentry kind="src" output="target/test-classes" 
path="target/generated-sources">

    <attributes>

        <attribute name="optional" value="true"/>

        <attribute name="maven.pomderived" value="true"/>

        <attribute name="test" value="true"/>

    </attributes>

</classpathentry>

Why does M2E consider these generated-sources as test-classes, i.e. puts them 
into the target/test-classes folder and marks that path with 'attribute 
name="test" value="true"' ??? Of course the compilation of dependent projects 
then invariably fails because imports of these generated classes can not be 
satisfied. :-( 

If I manually mangle the .classpath file and change the output path to 
'output="target/classes"' and remove the test-attribute, then things work fine. 
But shortly after Eclipse will mark my project faulty because it is out-of-sync 
with regards to the pom.xml and requires me to do a Maven -> Update project. 
But this changes things back to faulty and the compilation fails again. :-(( 

Is there anything wrong with the pom or is that a bug in M2E or how can I 
correct that situation?

 

_______________________________________________
m2e-users mailing list
m2e-users@eclipse.org <mailto:m2e-users@eclipse.org> 
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/m2e-users

_______________________________________________
m2e-users mailing list
m2e-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/m2e-users

Reply via email to