users@jaxb.java.net

Re: JAXB compilation plugin

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 28 Feb 2006 13:49:04 -0800

Malachi de Ælfweald wrote:
>> I suggested that eventually it should be possible to read in the plugin
>> configuration directly into Ant task definition, so you can write:
>>
>> <plugin>
>> <groupId>com.sun.tools.xjc.maven2</groupId>
>> <artifactId>maven-jaxb-plugin</artifactId>
>> <executions>...</executions>
>> <configuration>
>> <xjc ant task definition here />
>> </configuration>
>>
>> ... instead of defining its own syntax for the maven plugin. I plan to
>> look at the code to see how hard it is to do this, and hopefully I
>> should be able to submit a patch for a consideration of Jonathan.
>>
>> I think reusing the same syntax would reduce the amount of work, as well
>> as being easier to understand.
>
>
> I think that idea works well for those of us who have used Ant in the
> past... but for users that are new to Maven2, they are likely not to learn
> Ant syntax at all. I know my current build doesn't use any Ant syntax at
> all. We should try to keep those users in mind.

Those people still have to learn some syntax, so as long as we position
the documentation correctly, I don't think it's any harder for any of
our users.

But Jonathan doesn't seem to like the idea either, so maybe this is moot.


> As a side note, I think this is an area that might do well to have some
> work. When we modify the codemodel, we have to have those plugins already
> compiled first... however, in most build systems, jaxb is during the
> generate-sources phase. If the plugin sources are part of their build, they
> would be available at compile time, but not necessarily at
> generate-sources... Perhaps we could add some logic to the codemodel to
> allow referencing interfaces/classes by name that are not validated until
> compile time -- ie: ability to let the user say "I want the class to
> implement ThisInterface, which will be available later". Just a thought.

CodeModel already allows you to refer to types without actually having
their definition. Just use JCodeModel.ref() or JCodeModel.parseType().


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com