5

We have migrated to Java 1.6 and as part of the there is a re-write of the ant tasks that used the older xjc ant task to use the executable: xjc.exe provided in Java 1.6

We also need to retain older ant task parameters like using commons-lang plugin to generate toString() methods in the generated value objects.

Earlier:

<target name="generate_vos" description="Compile all Java source files">
    <echo message="Compiling the schema..." />
    <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
        <classpath refid="ERPSimulator.classpath"/>
    </taskdef>
    <delete dir="${jaxb.src}" />
    <mkdir dir="${jaxb.src}" />
    <xjc schema="${jaxb.schema}/SOAPClientObjects.xsd" package="xxx.jaxb.vo" destdir="${jaxb.src}">
        <arg value="-Xcommons-lang" />
        <arg value="-Xcommons-lang:ToStringStyle=SIMPLE_STYLE" />
        <produces dir="${jaxb.src}" includes="**/*.java" />
    </xjc>
</target>

Now:

 <target name="generate_vos" description="Compile all Java source files">       
        <delete dir="${jaxb.src}" />
        <mkdir dir="${jaxb.src}" />
        <echo message="Compiling the schema..." />
         <exec executable="xjc">
             <arg value="-extension"/>
             <arg value="-d"/>
             <arg value="${jaxb.src}"/>
             <arg value="-p"/>
             <arg value="xxxx.jaxb.vo"/>
             <arg value="${jaxb.schema}/SOAPClientObjects.xsd"/>        
             <arg value="-Xcommons-lang"/>
             <arg value="-Xcommons-lang:ToStringStyle=SIMPLE_STYLE" />
         </exec>
</target>

However, running the new task results in errors as the -Xcommons* plugins are not carried forward in this version. I have explicitly set the plugin jar files for the commons-lang toString plugin in the path too with no luck.

Any idea how to make XJC.exe generate the toString() method for the resultant Objects?

Thanks!

4

0 回答 0