Jaxb2-maven-plugin add classpath to generated sources

I use codehaus jaxb-maven-plugin to create Java classes from xml schemas:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>2.2</version>
            <executions>
                <execution>
                    <id>xjc</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>src/my.xsd</source>
                        </sources>                           
                            <packageName>mypackage</packageName>
                    </configuration>
                </execution>
            </executions>
         </plugin>

Classes are generated as expected in target/generated-sources/jaxb, but this path is not added to the class path.

So, if I use some of the generated classes in other (non-generated) classes, maven cannot find it during the compilation process.

Any ideas? TIA!

+4
source share
2 answers

This is the error in jaxb2-maven-plugin:

https://github.com/mojohaus/jaxb2-maven-plugin/issues/44

+3
source

MacOS El Capitain 2.2 , "mvn clean compile", . "mvn compile", .

:

-sourcepath /Users/nastacio/rsawga-rtc/workspace_trunk/ml-common/src/main/java:/Users/nastacio/rsawga-rtc/workspace_trunk/ml-common/target/generated-sources/jaxb:

jaxb:

-sourcepath /Users/nastacio/rsawga-rtc/workspace_trunk/ml-common/src/main/java: -s /Users/nastacio/rsawga-rtc/workspace_trunk/ml-common/target/generated-sources/annotations
0

All Articles