java - JAXB schemagen doesn't reference classes in episode file -
i using schema first approach, hit roadblock "ominous" jaxb map problem! , worked around switching code first approach one. i'd reuse type in other modules , continue schema first approach creating episode file generated schema. unfortunately generated episode file empty. here tried:
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>jaxb2-maven-plugin</artifactid> <version>2.2</version> <executions> <execution> <id>schemagen</id> <goals> <goal>schemagen</goal> </goals> <phase>generate-sources</phase> </execution> </executions> <configuration> <outputdirectory>${project.build.outputdirectory}</outputdirectory> <generateepisode>true</generateepisode> <transformschemas> <transformschema> <uri>http://some/schema/types</uri> <toprefix>core</toprefix> <tofile>core-types.xsd</tofile> </transformschema> </transformschemas> </configuration> </plugin>
this generated me following schema:
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:core="http://some/schema/types" targetnamespace="http://some/schema/types" version="1.0"> <xs:element name="map" type="core:maptype"/> <xs:complextype name="maptype"> <xs:sequence> <xs:element maxoccurs="unbounded" minoccurs="0" name="entries" nillable="true" type="core:entrytype"/> </xs:sequence> </xs:complextype> <xs:complextype name="entrytype"> <xs:sequence> <xs:element name="key" type="xs:anytype"/> <xs:element name="value" type="xs:anytype"/> </xs:sequence> </xs:complextype> </xs:schema>
and episode file content:
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <ns1:bindings version="2.1" xmlns:ns1="http://java.sun.com/xml/ns/jaxb"/>
i tried use schemagen standalone (version 2.2.11) similar results. documentation @ https://jaxb.java.net/2.2.4/docs/schemagen.html , http://www.mojohaus.org/jaxb2-maven-plugin/documentation/v2.2/schemagen-mojo.html seams indicate should it, can't figure out doing wrong.
i resolve problem... follow above:
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>jaxb2-maven-plugin</artifactid> <version>1.6</version> <executions> <execution> <id>schemagen</id> <goals> <goal>schemagen</goal> </goals> **<phase>generate-sources</phase>** </execution> </executions> <configuration> **<xsdpathwithinartifact>generated/xsds</xsdpathwithinartifact>** </configuration> </plugin>
Comments
Post a Comment