users@jaxb.java.net

RE: JAXB compilation plugin

From: Jonathan Johnson <jonjohnson_at_mail.com>
Date: Fri, 27 Jan 2006 21:31:49 -0500

Kohsuke,

Yes, start simple and grow the features as needed. The Ant JAXB features
are a good guideline
(http://java.sun.com/webservices/docs/1.6/jaxb/ant.html) for Mavenizing. As
you suggested using com.sun.tools.xjc.XJC2Task would be best since it builds
on the ant experience, eases the transition from ant and adapts to future
needs.

James' suggestion is excellent.

I tried contacting the people on the list for the JAXB Maven 1 plugin but no
answer so far. Also, looked at the M1 jelly code and it seemed lightweight.

I saw your request for a maven 2 plugin -- coincidentally put in two days
before I contacted you. I guess its high time to get started.
https://jaxb.dev.java.net/issues/show_bug.cgi?id=118

Thanks for the CVS access. I'm new to contributing to open source. Can you
point me to the guidelines and standards for create and submitting code.
What java version is the target? Do I create a build.xml as well (no
pom.xml) ;-(? Etc..


-----Original Message-----
From: Kohsuke Kawaguchi [mailto:kohsuke.kawaguchi_at_sun.com]
Sent: Friday, January 27, 2006 8:33 PM
To: users_at_jaxb.dev.java.net
Subject: Re: JAXB compilation plugin



Welcome! I added you to http://jaxb2-sources.dev.java.net/ as a
developer, so you should be able to put your files to CVS [1]

Jonathan Johnson wrote:
> Kohsuke suggested creating a JAXB 2 Maven plugin for java.net. Both the
JAXB
> and Maven efforts could benefit from this - so here we go...
>
> I invite anyone to contribute advice for the following...
>
> Requirements for the JAXB/Mavin 2 plugin.

I think we can start with the simplest. A plugin that invokes XJC with a
bunch of options, in the pre compilation phase of maven 2.

> JAXB generation procedures, configurations and gotchas

I can think of a few ways to go.

   - com.sun.tools.xjc.api.Driver.main is the CLI entry point,
     so you can invoke this to drive the entire XJC. The Driver
     class has a few other run methods that's useful for
     automation (such as one that takes XJCListener, which allows
     you to (probably) easily hook error report into Maven's
     error report system.

     This is easier to drive, but you have to define yet another
     syntax for configuring XJC in pom.xml, then you have to convert
     them to String[].

   - com.sun.tools.xjc.XJC2Task is the Ant task implementation.
     Since Maven also configures plugins through XML, it would
     be really nice if the plugin configuration XML can be used
     to populate an XJC2Task instance. In that way, we can reuse
     XJC's ant task syntax with Maven, so people don't have to
     learn a new syntax, and there's no need to constantly update
     a plugin to keep up with syntax changes in XJC (not that it
     happens often, but still...)

     I'd imagine this would be harder, but I'd imagine there's
     some code either in Ant or Maven that you can reuse.

> Maven 2 plugin development

As James suggested, I think it's easier to start by looking at what
other plugins do. If you don't mind using the same license as they do,
then you can even copy their code.


[1]
https://jaxb2-sources.dev.java.net/source/browse/jaxb2-sources/jaxb-maven2-p
lugin/
--
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com