Additionally, this post by Dominque Devienne might help a bit... http://marc.theaimsgroup.com/?l=ant-user&m=103730621918507&w=2
And here are my targets using the JAXB task....
<!-- specify location of jar file in a properties file --> <property name="jaxbtask.jar" location="${location.jaxbtask}/${version.jaxbtask}"/>
<path id="build.classpath"> ... ... ... <pathelement location="${jaxbtask.jar}"/> <fileset dir="${web.home}/WEB-INF/jars/jaxb" > <include name="jaxb-*.jar"/> <include name="jax-qname.jar"/> </fileset> </path>
<target name="compile.jaxb.task" depends="prepare" description="Compile Java sources" >
<!-- Compile Java classes as necessary -->
<mkdir dir="${build.home}/WEB-INF/classes"/>
<javac
srcdir="${src.home}"
destdir="${build.home}/WEB-INF/classes"
includes="com/lgc/buildmagic/**/*.java"
excludes="**/old**/**"
debug="${build.debug}"
deprecation="${build.deprecation}"
optimize="${build.optimize}"
verbose="${build.verbose}">
<classpath>
<pathelement path="${web.home}/WEB-INF/jars/jaxb/jaxb-xjc.jar"/>
</classpath>
</javac>
</target>
<target name="jar.jaxb.task" depends="compile.jaxb.task" description="creates the custom JAXB taskdef jar">
<jar jarfile="${jaxbtask.jar}" > <fileset dir="${build.home}/WEB-INF/classes"> <include name="com/lgc/buildmagic/**/*.class" /> </fileset> </jar>
</target>
<target name="jaxb" depends="jar.jaxb.task" description="Generates (using Jaxb) Java code from XML schemas">
<taskdef name="jaxb" classname="com.lgc.buildmagic.JaxbSchemaCompiler" > <classpath refid="build.classpath" /> </taskdef>
<jaxb destDir="${src.home}" readOnly="true" strictValidation="true" xjcjar="${web.home}/WEB-INF/jars/jaxb/jaxb-xjc.jar"> <schemas dir="${src.schema.home}" includes="**/*.xsd" /> <!-- Custom mapper to deduce the target package name: For example, schema com/lgc/infra/acme/doc-files/tools.xsd yields package name com.lgc.infra.acme.generated.tools --> <targetPackageMapper type="regexp" from="(.*)/(.*)\.xsd" to="\1/generated/\2" /> </jaxb> </target>
<target name="clean.jaxb.generated"> <delete includeEmptyDirs="true" quiet="true"> <fileset dir="${src.home}" includes="**/generated/**" /> </delete> </target>
This has been tested to work under Ant-1.5.1, Ant-1.5.2, and Ant-1.5.3beta.
Jake
At 12:09 PM 4/2/2003 +0200, you wrote:
I am using the alternative implementation from http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14640 without any problems.
> -----Original Message----- > From: webhiker [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 02, 2003 11:22 AM > To: Ant Users List > Subject: Anyone got any workaround ideas on the broken Jaxb stuff? > > > Just wondering if anyones found a decent fix for the silly parser > dependancies of the xjc task (com.sun.tools.xjc.XJCTask) > which requires > manually setting ANT_OPTS to contain a special > -Djava.endorsed.dirs to > find it's xalan.jar and xerces.jar rubbish. > > Is there no other way to set the endorsed dirs from within > the build.xml > file? I think the problem is from the fact that the xjc task > is in the > same JVM as Ant, and thus the endorsed dirs cannot be modified. > > I'd appreciate any intelligent workarounds. > > WH > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]