users@jaxb.java.net

Re: JAXB compilation plugin

From: Malachi de Ælfweald <malachid_at_gmail.com>
Date: Thu, 2 Mar 2006 14:33:27 -0800

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>

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...

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....

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


Malachi


On 3/2/06, Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_sun.com> wrote:
>
> Malachi de Ælfweald wrote:
> > Sure...
> > I would rather do:
> > <configuration>
> > <extension>org.eoti.codemodel.ImplementToJAXBElement</extension>
> > <extension>org.eoti.codemodel.ExtendMyBaseClass</extension>
> > <strict>false</strict>
> > </configuration>
> >
> > and assume a default src/target directory based on maven standards
> > (src/main, target/jaxb), not use any filesets, not use regex,
> classpaths,
> > etc....
>
> Yeah, we can have some values defaulted just in Maven. For example, we
> can default to <schema dir="src/main/schemas" includes="**/*.xsd" />.
> Similarly we can have some default for loading JAXB extensions, or even
> slightly extended syntax.
>
> But do you really care if it's:
>
> <configuration>
> <strict>false</strict>
> ...
> </configuration>
>
> or
> <configuration>
> <xjc strict="false">
> ...
> </xjc>
> </configuration>
>
> ? I mean, in terms of numbers, those trivial options are the majority,
> aren't they?
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
>