https://issues.apache.org/jira/browse/AMQCLI-2

Switching to cxf-xjc-plugin and adding support for the builder pattern
on generated jaxb classes
diff --git a/activemq-kahadb-exporter/pom.xml b/activemq-kahadb-exporter/pom.xml
index 9335e2e..1247661 100644
--- a/activemq-kahadb-exporter/pom.xml
+++ b/activemq-kahadb-exporter/pom.xml
@@ -97,45 +97,33 @@
         </executions>
       </plugin>
       <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>jaxb2-maven-plugin</artifactId>
-        <version>${jaxb2-maven-plugin-version}</version>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-xjc-plugin</artifactId>
+        <version>${cxf-xjc-plugin-version}</version>
         <executions>
           <execution>
-            <id>xjc</id>
+            <id>compile-xsd</id>
             <phase>generate-sources</phase>
             <goals>
-              <goal>xjc</goal>
+              <goal>xsdtojava</goal>
             </goals>
           </execution>
         </executions>
         <configuration>
-          <xjbSources>
-            <xjbSource>${project.build.directory}/artemis-cli/schema/artemis-import-export.xjb</xjbSource>
-          </xjbSources>
-          <sources>
-            <source>${project.build.directory}/artemis-cli/schema/artemis-import-export.xsd</source>
-          </sources>
-          <packageName>org.apache.activemq.cli.schema</packageName>
+          <extensions>
+            <extension>net.codesup.util:jaxb2-rich-contract-plugin:${jaxb2-rich-contract-plugin-version}</extension>
+          </extensions>
+          <xsdOptions>
+            <xsdOption>
+              <xsd>${project.build.directory}/artemis-cli/schema/artemis-import-export.xsd</xsd>
+              <bindingFile>${project.build.directory}/artemis-cli/schema/artemis-import-export.xjb</bindingFile>
+              <extensionArgs>
+                <extensionArg>-Xfluent-builder</extensionArg>
+              </extensionArgs>
+            </xsdOption>
+          </xsdOptions>
         </configuration>
       </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>build-helper-maven-plugin</artifactId>
-        <executions>
-          <execution>
-            <phase>generate-sources</phase>
-            <goals>
-              <goal>add-source</goal>
-            </goals>
-            <configuration>
-              <sources>
-                <source>${project.build.directory}/generated-sources/jaxb</source>
-              </sources>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
     </plugins>
   </build>
 </project>
diff --git a/activemq-kahadb-exporter/src/main/resources/artemis-import-export.xjb b/activemq-kahadb-exporter/src/main/resources/artemis-import-export.xjb
index 079eeb9..3f2eea3 100644
--- a/activemq-kahadb-exporter/src/main/resources/artemis-import-export.xjb
+++ b/activemq-kahadb-exporter/src/main/resources/artemis-import-export.xjb
@@ -23,7 +23,7 @@
 
     <!-- Customize the package name -->
     <schemaBindings>
-      <package name="org.apache.activemq.schema" />
+      <package name="org.apache.activemq.cli.schema" />
     </schemaBindings>
 
     <!-- There is already a value field so map the value attribute to a new name -->
diff --git a/pom.xml b/pom.xml
index 8be5dd3..dc06c89 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,8 +45,9 @@
     <mockito-version>1.10.19</mockito-version>
     
     <!-- Maven Plugins -->
-    <jaxb2-maven-plugin-version>2.2</jaxb2-maven-plugin-version>
+    <cxf-xjc-plugin-version>3.0.1</cxf-xjc-plugin-version>
     <build-helper-plugin-version>3.0.0</build-helper-plugin-version>
+    <jaxb2-rich-contract-plugin-version>1.18.0</jaxb2-rich-contract-plugin-version>
   </properties>
 
   <url>http://activemq.apache.org</url>