I use the XMLBeans Maven plugin to generate classes based on an XSD file. I am able to write code using my generated classes and Eclipse shows target/generated-sources/xmlbeans
as a source folder. However, when I try to run my test code I get the classic error:
java.lang.ClassNotFoundException: schemaorg_apache_xmlbeans.system.sCFA0DE5D65ADE16E20A85EAFD5A886E4.TypeSystemHolder
If I look in my project folder, I can see this class file in the folder target\generated-classes\xmlbeans\schemaorg_apache_xmlbeans\system\sCFA0DE5D65ADE16E20A85EAFD5A886E4
.
Is there a change I can make to my POM file to make Eclipse know where to find these classes? I imagine there are a number of ways to manually fix this problem and tell Eclipse to add that folder to the classpath, but I'd prefer an automatic solution.
POM snippet
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<version>2.3.3</version>
<executions>
<execution>
<goals>
<goal>xmlbeans</goal>
</goals>
</execution>
</executions>
<inherited>true</inherited>
<configuration>
<schemaDirectory>src/main/xsd</schemaDirectory>
<download>true</download>
<javaSource>1.5</javaSource>
</configuration>
</plugin>