jaxb2-maven-plugin add classpath to generated sources

Viewed 4073

I use the 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>

The classes are generated as expected to target/generated-sources/jaxb, but this path is not added to the classpath.

So, if I use some of generated classes in other (not generated) classes, maven cannot found it during the compile process.

Any ideas? TIA!

2 Answers
Related