. ---> pom.xml ./.settings ./src ./src/main ./src/main/binding ---> binding.xjb ./src/main/java ./src/main/java/com ./src/main/java/META-INF ./src/main/resources ---> my.xsd
The maven plugin configuration in the pom.xml
<plugins> <plugin> <groupid>org.jvnet.jaxb2.maven2</groupid> <artifactid>maven-jaxb2-plugin</artifactid> <version>0.7.4</version> <configuration> <extension>true</extension> <args> <arg>-Xfluent-api</arg> </args> <schemadirectory>src/main/resources</schemadirectory> <bindingdirectory>src/main/binding</bindingdirectory> <plugins> <plugin> <groupid>net.java.dev.jaxb2-commons</groupid> <artifactid>jaxb-fluent-api</artifactid> <version>2.1.8</version> </plugin> </plugins> </configuration> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin> </plugins>
The content of the binding.xjb
<jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jxb:extensionBindingPrefixes="xjc"> <jxb:bindings> <jxb:globalBindings> <xjc:serializable/> </jxb:globalBindings> </jxb:bindings> </jxb:bindings>
The result:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "application", propOrder = {
"name",
"version",
"state",
"serverName"
})
public class Application
implements Serializable
{
@XmlElement(required = true)
protected String name;
@XmlElement(required = true)
protected String version;
@XmlElement(required = true)
protected String state;
No comments:
Post a Comment