2 Replies Latest reply on Nov 4, 2012 6:23 PM by jschellSomeoneStoleMyAlias

    How to convert code using com.sun.tools.jxc.SchemaGenTask

      I 've been search the web high and low and I still can't find how to change code that is using the old SchemaGen ANT task to something that works with JDK 8 where the class is not longer included.

      E.g.I have a Maven build that is using the ANT task that fails with:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (generate-schemas) on project MyProject: An Ant BuildException has occured: taskdef A class needed by class com.sun.tools.jxc.SchemaGenTask cannot be found: com/sun/mirror/apt/AnnotationProcessorFactory
      [ERROR] using the classloader ...snip...
      [ERROR] around Ant part ...<taskdef classname="com.sun.tools.jxc.SchemaGenTask" name="schemagen" classpathref="maven.compile.classpath"/>... @ 6:113 in /Users/scott/dev/Path_to_my_project/target/antrun/build-main.xml: com.sun.mirror.apt.AnnotationProcessorFactory

      This has been marked deprecated for a while, with vague references to using javac annotation processing, but never any actual information about how to convert such code.

      The JDK 8 docs still link to it in fact.

      The link to the ANT task there fails.. But I found this (remove the '.dev') :

      Which basically instructs you to do what doesn't work.

      What's the deal?
        • 1. Re: How to convert code using com.sun.tools.jxc.SchemaGenTask
          I should also point out that JDK 8 links to JAXB 2.1.3 docs (or tries to), but JDK 7 includes JAXB 2.2.4 according to:

          And it remains unclear if any classpath is necessary in :

          <taskdef name="schemagen" classname="com.sun.tools.jxc.SchemaGenTask">
          <fileset dir="path/to/jaxb/lib" includes="*.jar" />

          given that JAXB is included in the JDK. According to the above URL, "...the JAXB RI in JDK is package renamed to avoid any conflict with the stand-alone JAXB RI distribution..." Which leads me to think this may be a simple matter of figuring out what the correct package is for the SchemaGenTask. Perhaps I'm picking up some external to the JDK copy and the internal AnnotationProcessor bits it is expecting are not in the expected package.

          • 2. Re: How to convert code using com.sun.tools.jxc.SchemaGenTask
            If it is just a package name then you can look in the jars (or extract them) and just look for the class name.