After a long day and a half of hacking I wound up using ant to run a shell script. I could not figure out how to file bug report .
I am using eclipse luna. To get this work correctly I also needed to install the eclipse plugin http://mojo.codehaus.org/build-helper-maven-plugin/ It adds support for the <add_source> goal Bellow is my final solution. Hope this helps someone else Andy p.s. its does not seem like this mail list shows up in google search results <properties> <xjc.output.dir>${project.build.directory}/generated-sources/src/main/java</xjc.output.dir> </properties> <build> <plugins> <plugin> <!-- jaxb2-maven-plugin does not work with latest version of java http://www.journaldev.com/1312/how-to-generate-java-classes-from-xsd-using-xjc-maven-plugin http://mojo.codehaus.org/jaxb2-maven-plugin/ --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>xjc</id> <phase>generate-sources</phase> <goals> <goal>run</goal> </goals> <configuration> <target> <mkdir dir="${xjc.output.dir}" /> <exec executable="sh"> <arg line="${basedir}/src/main/bin/runXJC.sh ${xjc.output.dir} ${project.basedir}/src/main/xsd/global.xjb ${project.basedir}/src/main/xsd" /> </exec> </target> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>${xjc.output.dir}</source> </sources> </configuration> </execution> </executions> </plugin> </plugins> </build> This is the listing for runXJC.sh #!/bin/sh -x ############################################################################### # SET THESE VALUES ############################################################################### set -x # turn debugging on # set +x # turn debugging off OUTPUT_DIR=${1} XJB_FILE=${2} XSD_FILES=`ls ${3}/*.xsd` ############################################################################### # DO NOT EDIT BELOW THIS LINE ############################################################################### ALL_XSD_FILES="" LOG_FILE_PATH=$OUTPUT_DIR"/"$LOG_FILE for XSD_FILE_NAME in $XSD_FILES do ALL_XSD_FILES=$ALL_XSD_FILES" "$XSD_FILE_NAME done xjc -d $OUTPUT_DIR -extension -b $XJB_FILE $ALL_XSD_FILES #2>&1 | tee $LOG_FILE_PATH On Jul 24, 2014, at 11:09 PM, Anders Hammar <[email protected]> wrote: > Could it be this: > http://stackoverflow.com/questions/18493541/invalid-jaxp-api-when-unmarshaling-jaxb > > /Anders > > > On Fri, Jul 25, 2014 at 3:31 AM, Andrew Davidson <[email protected]> > wrote: > >> Hello >> >> I am having a heck of a time working with XSD files and maven. I am >> working on a mac. It looks like I have the latest and greatest xjc. >> >> Any idea what my bug is? >> >> Kind regards >> >> Andy >> >> $ which java >> /usr/bin/java >> $ java -version >> java version "1.7.0_21" >> Java(TM) SE Runtime Environment (build 1.7.0_21-b12) >> Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode) >> $ which xjc >> /usr/bin/xjc >> $ xjc -version >> xjc 2.2.4-2 >> $ >> >> >> [INFO] --- jaxb2-maven-plugin:1.6:xjc (xjc) @ athena-aide-myaccess --- >> [INFO] Generating source... >> [INFO] parsing a schema... >> Jul 24, 2014 6:22:34 PM com.sun.xml.bind.v2.util.XmlFactory >> createDocumentBuilderFactory >> SEVERE: null >> java.lang.AbstractMethodError: >> javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V >> at >> com.sun.xml.bind.v2.util.XmlFactory.createDocumentBuilderFactory(XmlFactory.java:192) >> at >> com.sun.tools.xjc.reader.internalizer.DOMForest.<init>(DOMForest.java:162) >> at >> com.sun.tools.xjc.ModelLoader.buildDOMForest(ModelLoader.java:315) >> at >> com.sun.tools.xjc.ModelLoader.loadXMLSchema(ModelLoader.java:377) >> at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:174) >> at com.sun.tools.xjc.ModelLoader.load(ModelLoader.java:119) >> at com.sun.tools.xjc.Driver.run(Driver.java:333) >> at >> org.codehaus.mojo.jaxb2.AbstractXjcMojo.execute(AbstractXjcMojo.java:316) >> at >> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) >> at >> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) >> at >> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) >> at >> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) >> at >> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) >> at >> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) >> at >> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) >> at >> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) >> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) >> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) >> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) >> at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) >> at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >> at java.lang.reflect.Method.invoke(Method.java:601) >> at >> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) >> at >> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) >> at >> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) >> at >> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) >> >> [INFO] >> ------------------------------------------------------------------------ >> [INFO] BUILD FAILURE >> [INFO] >> ------------------------------------------------------------------------ >> [INFO] Total time: 1.843s >> [INFO] Finished at: Thu Jul 24 18:22:34 PDT 2014 >> [INFO] Final Memory: 9M/24M >> [INFO] >> ------------------------------------------------------------------------ >> [ERROR] Failed to execute goal >> org.codehaus.mojo:jaxb2-maven-plugin:1.6:xjc (xjc) on project >> athena-aide-myaccess: You are running with invalid JAXP api or >> implementation. JAXP api/implementation of version 1.3.1 (included in JDK6) >> or higher is required. In case you are using ant, make sure ant 1.7.0 or >> higher is used - older versions of ant contain JAXP api/impl version 1.2 >> (in xml-apis.jar). If you want to keep using older ant versions, you have >> to configure it to use higher the JAXP api/impl versions. >> javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V >> -> [Help 1] >> [ERROR] >> >> >> In my parent pom.xml I have >> >> <plugin> >> <groupId>org.apache.maven.plugins</groupId> >> <artifactId>maven-compiler-plugin</artifactId> >> <version>3.1</version> >> <configuration> >> <source>1.7</source> >> <target>1.7</target> >> <fork>true</fork> >> <meminitial>512m</meminitial> >> <maxmem>1024m</maxmem> >> </configuration> >> </plugin> >> >> I have the following in my child pom.xm >> >> <build> >> <plugins> >> <plugin> >> <!-- >> >> http://www.journaldev.com/1312/how-to-generate-java-classes-from-xsd-using-xjc-maven-plugin >> >> http://mojo.codehaus.org/jaxb2-maven-plugin/ >> --> >> <groupId>org.codehaus.mojo</groupId> >> <artifactId>jaxb2-maven-plugin</artifactId> >> <version>1.6</version> >> <executions> >> <execution> >> <id>xjc</id> >> <goals> >> <goal>xjc</goal> >> </goals> >> </execution> >> </executions> >> <configuration> >> <arguments>-extension -npa -b >> ${project.basedir}/src/main/xsd/global.xjb</arguments> >> <!-- >> <packageName>com.example.myschema</packageName> --> <!-- The name of your >> generated source package --> >> </configuration> >> </plugin> >> </plugins> >> </build> >> >> >>
