I'm using the maven-jaxb2-plugin and my .xsd files are in a maven dependency. The documentation shows that you specify a .xsd in a maven dependency like this
<schema>
<!-- Specifies a schema from the Maven artifact. -->
<dependencyResource>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin-tests-po</artifactId>
<!-- Version of the artifact. May be omitted.
The plugin will then try to find the version using
the dependencyManagement and dependencies of the project. -->
<version>${project.version}</version>
<!-- Path of the resource within the artifact. -->
<resource>purchaseorder.xsd</resource>
</dependencyResource>
</schema>
I want to run xjc on all .xsd files in the dependent .jar file. The .xsd files are in different directories within the .jar file. I've tried this
<resource>**/*.xsd</resource>
but that fails with this Exception
org.xml.sax.SAXParseException; schema_reference.4: Failed to read schema document 'maven:com.dg:XSD:jar::5.0.3.4!/**/*.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
Is there a way to specify all .xsd files in a mvn dependency when they are in different directories?
Also, can xjc sort out a dependency tree on a group of .xsd files where one .xsd file depends on another, which may depend on another, ...?
Thanks.