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-plugin/
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com