XMLBeans is a technology for accessing XML by binding it to Java types. Simply compile your XML schemas to generate Java types that represent schema types. In this way, you can access instances of the schema through JavaBeans-style accessors after the fashion of "getFoo" and "setFoo". This can be incorporated into Maven with the xmlbeans-maven-plugin. Simply put your XSDs in the directory src/main/xsd configure your pom.xml (see below) and Voila, Maven will do all the grunt work for you. There is just one little glitch (plugin version 2.3.3), you will have to run 'mvn clean' before running any other phases or you will end up with a NoClassDefFoundError.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<version>2.3.2</version>
<executions>
<execution>
<id />
<phase>generate-sources</phase>
<goals>
<goal>xmlbeans</goal>
</goals>
</execution>
</executions>
<configuration>
<quiet>false</quiet>
<outputJar>target/xsd.jar</outputJar>
</configuration>
</plugin>
</plugins>
</build>
...
<dependencies>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.4.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans-qname</artifactId>
<version>2.4.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans-xmlpublic</artifactId>
<version>2.4.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
Comments (0)
You don't have permission to comment on this page.