users@jaxb.java.net

Re: JAXB compilation plugin

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 02 Mar 2006 14:40:03 -0800

Malachi de Ælfweald wrote:
> Let's take your example for a sec.
>
>
>> can default to <schema dir="src/main/schemas" includes="**/*.xsd" />
>>
> so using Ant syntax, if I wanted to do "src/main" instead of
> "src/main/schemas":
> <xjc>
> <schema dir="src/main" includes="**/*.xsd"/>
> ...
> </xjc>

Yes, although I think "includes" can be optional -- I think there's
nothing wrong with defaulting @includes to "**/*.xsd" even for Ant.

> if I want to do the same thing with the Maven2 style
> <configuration>
> <schemaDir>src/main</schemaDir>
> ...
> </configuration>
>
> I just added the strict as an example of a config option I would definitely
> change on my personal builds... It is mostly the fileset/includes/excludes
> that I want to avoid... also, the Ant version has a tendency to have the
> <OpenTag> expand multiple lines, only to be self-closing or have no content
> between the open/close tags...

Yes. That's the common practice.


> To be more concrete.... I pulled up one of my old Ant build.xml files and
> took a look. The section where I am setting up the paths/classpaths/etc is
> 153 lines long. The <javadoc ...> tag has 6 lines of text before even
> getting to the contents between the tags... The xjc task was defined once
> per sub-module.
>
> The Maven2 approach uses many less attributes (and more tags) making the
> code a little more readable... and I only define the xjc once, even though
> it runs on probably 10 different submodules in different directories...

Regardless of the syntax, with Maven you still get the same "define once
& run for all modules" benefit, I think. You only need to define it at
the top-level POM, and modules inherit it, IIRC?


> They are both XML. I think the primary difference comes to defining things
> like filesets, classpaths, etc. And using more elements and less
> attributes.

If Maven folks don't like using attributes, then I guess reusing the Ant
syntax really doesn't work very well.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com