I have 2 service XSD files AService.xsd and BService.xsd each with different targetNamespace. Both of these use a common XSD called common.xsd. I use the JAXB Maven plugin to generate classes. Here's how,
<execution> <id>generate-package</id> <goals> <goal>generate</goal> </goals> <configuration> <extension>true</extension> <schemaIncludes> <include>schema/Aservice.xsd</include> <include>schema/Bservice.xsd</include> </schemaIncludes> <bindingIncludes> <include>schema/*.xjb</include> </bindingIncludes> <generatePackage>com.schema</generatePackage> <generateDirectory>src/main/java</generateDirectory> </configuration> </execution>
When i try to run this i get the following error.
ValidationType is defined in common.xsd
org.xml.sax.SAXParseException: A class/interface with the same name "com.schema.ValidationType" is already in use. Use a class customization to resolve this conflict. .......... org.xml.sax.SAXParseException: (Relevant to above error) another "ValidationType" is generated from here. ...... com.sun.istack.SAXParseException2: Two declarations cause a collision in the ObjectFactory class.
If i run the 2 service xsds in 2 different executions generating into 2 different packages, i get the same
ValidationType class in 2 different packages.
Any ideas on how to make JAXB recognize shared schemas?