users@jaxb.java.net

Re: how to call xjc from ant on Mac ?

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Thu, 29 Dec 2011 08:04:24 +0100

You'll need the <taskdef...> that refers to a .jar file only when you
call the xjc provided with one of the standalone JAXB releases, as
might be required when you can't make do with the JAXB that comes
with your Java distriibution. Otherwise, just call the xjc you have there
in /usr/bin/xjc, using ant's way of calling any executable (<exec>, isn't it?).

-W

On 28/12/2011, Andy Davidson <andy_davidson_at_apple.com> wrote:
> Hi
>
> I am using eclipse on a Mac, and need to be able to run xjc as part of my
> ant build process. I found
>
> http://jaxb.java.net/nonav/2.1.10/docs/xjcTask.html
>
> "The jaxb-xjc.jar file contains the XJCTask.class file, which allows the XJC
> binding compiler to be invoked from the Ant build tool. To use XJCTask,
> include the following statement in your build.xml file:
>
> <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
> <classpath>
> <fileset dir="path/to/jaxb/lib" includes="*.jar" />
> </classpath>
> </taskdef>"
>
> Any idea where I can find the required jar files?
>
> The Java distribution on Mac does not contain jar files?
>
> $ ant -version
> Apache Ant(TM) version 1.8.2 compiled on October 14 2011
> $
>
> $ xjc -version
> xjc version "JAXB 2.1.10 in JDK 6"
> JavaTM Architecture for XML Binding(JAXB) Reference Implementation, (build
> JAXB 2.1.10 in JDK 6)
> $
>
> $ file `which xjc`
> /usr/bin/xjc: Mach-O universal binary with 3 architectures
> /usr/bin/xjc (for architecture x86_64): Mach-O 64-bit executable x86_64
> /usr/bin/xjc (for architecture i386): Mach-O executable i386
> /usr/bin/xjc (for architecture ppc7400): Mach-O executable ppc
> $
> $ java -version
> java version "1.6.0_29"
> Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-10M3527)
> Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
>
> thanks in advance
>
> Andy
>