users@jaxb.java.net

Re: JAXB compilation plugin

From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
Date: Wed, 08 Feb 2006 22:04:08 -0800

Jonathan Johnson wrote:
> XJC2Task will not work because the code is tightly bound to the Ant classes
> (see XJC2Task.getProject()).

Yes, you are right that it's written for Ant.

But on the other hand, it's surprisingly easy to drive Ant from any Java
program. For example, in one of my hobby project Hudson, I use Ant's
copy task [1]. Maven1 did it all the time (through Jelly.)

So I think it's still possible to do this.

> There are two Driver classes, I'm unclear on the difference between the two
>
> com.sun.tools.xjc.api.Driver
> com.sun.tools.xjc.Driver
>
> In conclusion, I found that
>
> com.sun.tools.xjc.Driver.run(String[] args, XJCListener listener)
>
> will probably work the best.

That said, I think this method would be also just fine.

I'd mildly prefer for you to use the XJC2Task, because of the nice XML
syntax it already offers, but that's more complicated.

So I think your pick is sound --- and once you get started, and if you
are interested, perhaps I could help to hook up XJC2Task into the maven
plugin.


[1]
https://hudson.dev.java.net/source/browse/hudson/hudson/src/hudson/tasks/ArtifactArchiver.java?rev=1.2&view=markup
-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com