Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
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.moser@xxxxxxxxxx> 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@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/m2e-users

Back to the top