java - maven-jaxb2-plugin not compiling xsd on linux machine but works on windows? -
here code snippet pom.xml
<plugin> <groupid>org.jvnet.jaxb2.maven2</groupid> <artifactid>maven-jaxb2-plugin</artifactid> <version>0.8.3</version> </plugin>
here exception
[info] --- maven-jaxb2-plugin:0.8.3:generate (default) @ customer-project --- [error] error while parsing schema(s).location [ file:....customer.xsd{12,97}]. org.xml.sax.saxparseexception: src-resolve: cannot resolve name 'customer:customerapplication' a(n) 'element declaration' component. @ com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.createsaxparseexception(errorhandlerwrapper.java:195) @ com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.error(errorhandlerwrapper.java:131) @ com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(xmlerrorreporter.java:384) @ com.sun.org.apache.xerces.internal.impl.xs.traversers.xsdhandler.reportschemaerr(xsdhandler.java:2537)
first xsd relevant part
<?xml version="1.0" encoding="windows-1252" ?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns="http://www.cohbe.org/customerrequest" xmlns:customer="http://www.cohbe.org/customer" targetnamespace="http://www.cohbe.org/customerrequest" elementformdefault="qualified"> <xsd:import schemalocation="customerdetails.xsd" namespace="http://www.cohbe.org/customer"/> <xsd:element name="customernewrequest"> <xsd:complextype> <xsd:sequence> <xsd:element ref="customer:customerapplicationdetail" minoccurs="0"/> </xsd:sequence> </xsd:complextype> </xsd:element> ... </xsd:schema>
customerdetails.xsd(nested xsd) location same of first xsd. here relevant part
<?xml version="1.0" encoding="utf-8"?> <xsd:schema version="2.15" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns="http://www.cohbe.org/customer" targetnamespace="http://www.cohbe.org/customer" xmlns:countries="http://www.cohbe.org/counties" elementformdefault="qualified"> <!-- version 2.15 --> <xsd:import namespace="http://www.cohbe.org/states" schemalocation="states.xsd"/> <xsd:element name="customerapplicationdetail" type="customerapplicationdetail"/> <xsd:complextype name="customerapplicationdetail"> ..... </xsd:schema>
i had same issue valid xsds failed compile on linux worked on windows , mac. had turn off strict validation in maven-jaxb-2 plugin configuration :
<configuration> <schemadirectory>src/main/resources/xsd</schemadirectory> <strict>false</strict> <extension>true</extension> </configuration>
Comments
Post a Comment