ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: Anyone got any workaround ideas on the broken Jaxb stuff?
Date Wed, 02 Apr 2003 19:38:13 GMT
The only problem with hand picking the JARs you want or need from JWSDP is
the license of course... Not that you cannot do it, you just have to be very
careful you are not violating SUN's license. For the runtime, the JWSDP doc
clearly states all the JARs that need to be redistributed for JAXB (not to
run per se, but to obey the license terms). I was told people on the JAXB
forums have asked for a separate JAXB redistributable pack, and that SUN was
working on it... --DD

-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com] 
Sent: Wednesday, April 02, 2003 1:25 PM
To: Ant Users List
Subject: RE: Anyone got any workaround ideas on the broken Jaxb stuff?


Just a little update.  The example I showed below was based on the JAXB 
beta.  For the 1.0, you can make the following modifications without having 
to "conserve the JWSDP layout for this to work correctly" as Dominique 
mentioned....

Change:

  <jaxb destDir="${src.home}"
               readOnly="true"
               strictValidation="true"
               xjcjar="${web.home}/WEB-INF/jars/jaxb/jaxb-xjc.jar">

To:

<jaxb destDir="${src.home}"
               readOnly="true"
               strictValidation="true">
               <classpath refid="build.classpath" />


This assumes you have a directory in your build containing the jaxb-*.jar 
files + the jax-qname.jar file.  You don't need to have any of the dom, 
sax, namespace, or xercesImpl jars in that directory nor do you have to add 
anything to the JAVA_HOME/jre/lib/endorsed directory (except for maybe 
xalan of which I have the latest version from the apache site in there 
currently).  All this is already present in the default Ant 
environment.  The only one I have a question about is the namespace jar of 
which I don't think the libraries are present in the default Ant 
environment?  Not sure if the classes in that jar are not actually used by 
JAXB or if they just aren't used in compilation because the JAXB task is 
able to successfully compile schema's without it.

Anyway, the reason for ignoring the classpath using the xjcjar was more 
apparent when using the JAXB beta because the xerces version it included 
clashed a bit with the xerces that came with JAXB.  Doesn't seem to be a 
problem now because JAXB now works with the latest Xerces.

Jake

At 10:25 AM 4/2/2003 -0600, you wrote:

>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:webhiker@tiscali.fr]
>> > 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: user-unsubscribe@ant.apache.org
>> > For additional commands, e-mail: user-help@ant.apache.org
>> >
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>For additional commands, e-mail: user-help@ant.apache.org

Mime
View raw message