You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Nathan Coast <na...@codeczar.com> on 2003/10/10 05:45:01 UTC

castor plugin

Hi,

Is there any reason why the castor plugin doesn't provide 'ready to go' jelly 
script?  What I mean by this is that in order to use the castor plugin you have 
to write maven.xml that sets properties then calls tags defined within the 
castor plugin.  Isn't the more 'normal' plugin mechanism to define executable 
jelly script that you configure with properties?

would it be 'nicer' if the castor plugin did something like

javac any java sources
generate sources from an xsd - default from say src/castor/${pom.id}.xsd to 
target/castor/java
add target/castor/java to compile.src.set
call java:jar to compile and assemble the ${maven.final.name}.jar?

One thing I like about maven is that in general, if you place your sources in 
default locations, you don't have to write any jelly script or configure 
anything and the default goal for the plugin will do something sensible.

More than happy to modify / patch the castor plugin if that's what people want.

cheers
Nathan




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: castor plugin

Posted by Tim Anderson <tm...@netspace.net.au>.
Not overly fussed. Whatever works best for you.
If you provide support for one package per xsd, the properties
start getting hairy, e.g:
  maven.castor.src1 = foo.xsd
  maven.castor.package1 = org.foo.bar
  maven.castor.src2 = bar.xsd
  maven.castor.package2 = org.foo.fly
  maven.castor.type2 = j1
or:
  maven.castor.src.1 = foo.xsd, org.foo.bar
  maven.castor.src.2 = bar.xsd, org.foo.fly, j1

if you don't mind parsing property values.
IMO, this isn't any clearer than specifying it in maven.xml, just shorter.

If you can come up with some reasonable defaults, and
still support exising functionality, go for it.

-Tim

> -----Original Message-----
> From: Nathan Coast [mailto:nathan@codeczar.com]
> Sent: Monday, 13 October 2003 5:39 PM
> To: Maven Users List
> Subject: Re: castor plugin
> 
> 
> No problem,
> 
> what functionality would you like?  the ability to specify one 
> package for each xsd?
> 
> Tim Anderson wrote:
> 
> > Thats fine, so long as there is only a single target package.
> > In the two projects where I use castor, I have several.
> > 
> > Feel free to submit a patch - just don't break the existing
> > behaviour :)
> > 
> > -Tim
> > 
> > 
> >>-----Original Message-----
> >>From: Nathan Coast [mailto:nathan@codeczar.com]
> >>Sent: Friday, 10 October 2003 3:10 PM
> >>To: Maven Users List
> >>Subject: Re: castor plugin
> >>
> >>
> >>Hi,
> >>
> >>good point.  I think it should be possible to carefully chose
> >>values for the
> >>properties that would ensure that in 99% of cases no properties
> >>would need to be
> >>specified.  It would be fairly trivial to make the plugin operate on
> >>multiple xsd sources based on some pattern.
> >>
> >>defaults in plugin.properties e.g
> >>maven.castor.source=src/castor
> >>maven.castor.includes=**/*.xsd
> >>maven.castor.excludes=
> >>maven.castor.dest=${maven.build.dir}/castor
> >>maven.castor.package=${pom.package}
> >>maven.castor.types=j2
> >>
> >><some kinda looping>
> >>     <castor:generate schema="${my.xsd.file}"
> >>                      package="${maven.castor.package}"
> >>                      types="${maven.castor.types}"/>
> >></looping>
> >>
> >>
> >> From the example code you'd have to write a chunk of xml for
> >>each schema in
> >>your maven.xml. IMO, it's ugly to have to write similar xml
> >>script for each file.
> >>
> >><preGoal name="java:compile">
> >>     <attainGoal name="castor:prepare-filesystem"/>
> >>     <castor:generate schema="src/schemas/foo.xsd"
> >>                      package="com.foo.bar"
> >>                      types="j2"/>
> >>
> >>I do sincerely mean IMO.  I'm not saying I'm right, and that 
> everyone who
> >>disagrees must be wrong :)
> >>
> >>Tim Anderson wrote:
> >>
> >>
> >>>The main reason is that multiple parameters must
> >>>be specified to generate sources for a particular schema.
> >>>To specify these via properties would be ugly IMHO.
> >>>
> >>>Your preferred approach only allows one schema per project,
> >>>which is unrealistic.
> >>>
> >>>-Tim
> >>>
> >>>
> >>>
> >>>
> >>>>-----Original Message-----
> >>>>From: Nathan Coast [mailto:nathan@codeczar.com]
> >>>>Sent: Friday, 10 October 2003 1:45 PM
> >>>>To: Maven Users
> >>>>Subject: castor plugin
> >>>>
> >>>>
> >>>>Hi,
> >>>>
> >>>>Is there any reason why the castor plugin doesn't provide 'ready
> >>>>to go' jelly
> >>>>script?  What I mean by this is that in order to use the castor
> >>>>plugin you have
> >>>>to write maven.xml that sets properties then calls tags defined
> >>>>within the
> >>>>castor plugin.  Isn't the more 'normal' plugin mechanism to
> >>>>define executable
> >>>>jelly script that you configure with properties?
> >>>>
> >>>>would it be 'nicer' if the castor plugin did something like
> >>>>
> >>>>javac any java sources
> >>>>generate sources from an xsd - default from say
> >>>>src/castor/${pom.id}.xsd to
> >>>>target/castor/java
> >>>>add target/castor/java to compile.src.set
> >>>>call java:jar to compile and assemble the ${maven.final.name}.jar?
> >>>>
> >>>>One thing I like about maven is that in general, if you place
> >>>>your sources in
> >>>>default locations, you don't have to write any jelly script or
> >>
> >>configure
> >>
> >>>>anything and the default goal for the plugin will do 
> something sensible.
> >>>>
> >>>>More than happy to modify / patch the castor plugin if that's
> >>>>what people want.
> >>>>
> >>>>cheers
> >>>>Nathan
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>>>For additional commands, e-mail: users-help@maven.apache.org
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>>For additional commands, e-mail: users-help@maven.apache.org
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> > 
> > 
> > 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: castor plugin

Posted by Nathan Coast <na...@codeczar.com>.
No problem,

what functionality would you like?  the ability to specify one package for each xsd?

Tim Anderson wrote:

> Thats fine, so long as there is only a single target package.
> In the two projects where I use castor, I have several.
> 
> Feel free to submit a patch - just don't break the existing
> behaviour :)
> 
> -Tim
> 
> 
>>-----Original Message-----
>>From: Nathan Coast [mailto:nathan@codeczar.com]
>>Sent: Friday, 10 October 2003 3:10 PM
>>To: Maven Users List
>>Subject: Re: castor plugin
>>
>>
>>Hi,
>>
>>good point.  I think it should be possible to carefully chose
>>values for the
>>properties that would ensure that in 99% of cases no properties
>>would need to be
>>specified.  It would be fairly trivial to make the plugin operate on
>>multiple xsd sources based on some pattern.
>>
>>defaults in plugin.properties e.g
>>maven.castor.source=src/castor
>>maven.castor.includes=**/*.xsd
>>maven.castor.excludes=
>>maven.castor.dest=${maven.build.dir}/castor
>>maven.castor.package=${pom.package}
>>maven.castor.types=j2
>>
>><some kinda looping>
>>     <castor:generate schema="${my.xsd.file}"
>>                      package="${maven.castor.package}"
>>                      types="${maven.castor.types}"/>
>></looping>
>>
>>
>> From the example code you'd have to write a chunk of xml for
>>each schema in
>>your maven.xml. IMO, it's ugly to have to write similar xml
>>script for each file.
>>
>><preGoal name="java:compile">
>>     <attainGoal name="castor:prepare-filesystem"/>
>>     <castor:generate schema="src/schemas/foo.xsd"
>>                      package="com.foo.bar"
>>                      types="j2"/>
>>
>>I do sincerely mean IMO.  I'm not saying I'm right, and that everyone who
>>disagrees must be wrong :)
>>
>>Tim Anderson wrote:
>>
>>
>>>The main reason is that multiple parameters must
>>>be specified to generate sources for a particular schema.
>>>To specify these via properties would be ugly IMHO.
>>>
>>>Your preferred approach only allows one schema per project,
>>>which is unrealistic.
>>>
>>>-Tim
>>>
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>From: Nathan Coast [mailto:nathan@codeczar.com]
>>>>Sent: Friday, 10 October 2003 1:45 PM
>>>>To: Maven Users
>>>>Subject: castor plugin
>>>>
>>>>
>>>>Hi,
>>>>
>>>>Is there any reason why the castor plugin doesn't provide 'ready
>>>>to go' jelly
>>>>script?  What I mean by this is that in order to use the castor
>>>>plugin you have
>>>>to write maven.xml that sets properties then calls tags defined
>>>>within the
>>>>castor plugin.  Isn't the more 'normal' plugin mechanism to
>>>>define executable
>>>>jelly script that you configure with properties?
>>>>
>>>>would it be 'nicer' if the castor plugin did something like
>>>>
>>>>javac any java sources
>>>>generate sources from an xsd - default from say
>>>>src/castor/${pom.id}.xsd to
>>>>target/castor/java
>>>>add target/castor/java to compile.src.set
>>>>call java:jar to compile and assemble the ${maven.final.name}.jar?
>>>>
>>>>One thing I like about maven is that in general, if you place
>>>>your sources in
>>>>default locations, you don't have to write any jelly script or
>>
>>configure
>>
>>>>anything and the default goal for the plugin will do something sensible.
>>>>
>>>>More than happy to modify / patch the castor plugin if that's
>>>>what people want.
>>>>
>>>>cheers
>>>>Nathan
>>>>
>>>>
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: castor plugin

Posted by Tim Anderson <tm...@netspace.net.au>.
Thats fine, so long as there is only a single target package.
In the two projects where I use castor, I have several.

Feel free to submit a patch - just don't break the existing
behaviour :)

-Tim

> -----Original Message-----
> From: Nathan Coast [mailto:nathan@codeczar.com]
> Sent: Friday, 10 October 2003 3:10 PM
> To: Maven Users List
> Subject: Re: castor plugin
>
>
> Hi,
>
> good point.  I think it should be possible to carefully chose
> values for the
> properties that would ensure that in 99% of cases no properties
> would need to be
> specified.  It would be fairly trivial to make the plugin operate on
> multiple xsd sources based on some pattern.
>
> defaults in plugin.properties e.g
> maven.castor.source=src/castor
> maven.castor.includes=**/*.xsd
> maven.castor.excludes=
> maven.castor.dest=${maven.build.dir}/castor
> maven.castor.package=${pom.package}
> maven.castor.types=j2
>
> <some kinda looping>
>      <castor:generate schema="${my.xsd.file}"
>                       package="${maven.castor.package}"
>                       types="${maven.castor.types}"/>
> </looping>
>
>
>  From the example code you'd have to write a chunk of xml for
> each schema in
> your maven.xml. IMO, it's ugly to have to write similar xml
> script for each file.
>
> <preGoal name="java:compile">
>      <attainGoal name="castor:prepare-filesystem"/>
>      <castor:generate schema="src/schemas/foo.xsd"
>                       package="com.foo.bar"
>                       types="j2"/>
>
> I do sincerely mean IMO.  I'm not saying I'm right, and that everyone who
> disagrees must be wrong :)
>
> Tim Anderson wrote:
>
> > The main reason is that multiple parameters must
> > be specified to generate sources for a particular schema.
> > To specify these via properties would be ugly IMHO.
> >
> > Your preferred approach only allows one schema per project,
> > which is unrealistic.
> >
> > -Tim
> >
> >
> >
> >>-----Original Message-----
> >>From: Nathan Coast [mailto:nathan@codeczar.com]
> >>Sent: Friday, 10 October 2003 1:45 PM
> >>To: Maven Users
> >>Subject: castor plugin
> >>
> >>
> >>Hi,
> >>
> >>Is there any reason why the castor plugin doesn't provide 'ready
> >>to go' jelly
> >>script?  What I mean by this is that in order to use the castor
> >>plugin you have
> >>to write maven.xml that sets properties then calls tags defined
> >>within the
> >>castor plugin.  Isn't the more 'normal' plugin mechanism to
> >>define executable
> >>jelly script that you configure with properties?
> >>
> >>would it be 'nicer' if the castor plugin did something like
> >>
> >>javac any java sources
> >>generate sources from an xsd - default from say
> >>src/castor/${pom.id}.xsd to
> >>target/castor/java
> >>add target/castor/java to compile.src.set
> >>call java:jar to compile and assemble the ${maven.final.name}.jar?
> >>
> >>One thing I like about maven is that in general, if you place
> >>your sources in
> >>default locations, you don't have to write any jelly script or
> configure
> >>anything and the default goal for the plugin will do something sensible.
> >>
> >>More than happy to modify / patch the castor plugin if that's
> >>what people want.
> >>
> >>cheers
> >>Nathan
> >>
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: castor plugin

Posted by Nathan Coast <na...@codeczar.com>.
Hi,

good point.  I think it should be possible to carefully chose values for the 
properties that would ensure that in 99% of cases no properties would need to be 
specified.  It would be fairly trivial to make the plugin operate on
multiple xsd sources based on some pattern.

defaults in plugin.properties e.g
maven.castor.source=src/castor
maven.castor.includes=**/*.xsd
maven.castor.excludes=
maven.castor.dest=${maven.build.dir}/castor
maven.castor.package=${pom.package}
maven.castor.types=j2

<some kinda looping>
     <castor:generate schema="${my.xsd.file}"
                      package="${maven.castor.package}"
                      types="${maven.castor.types}"/>
</looping>


 From the example code you'd have to write a chunk of xml for each schema in 
your maven.xml. IMO, it's ugly to have to write similar xml script for each file.

<preGoal name="java:compile">
     <attainGoal name="castor:prepare-filesystem"/>
     <castor:generate schema="src/schemas/foo.xsd"
                      package="com.foo.bar"
                      types="j2"/>

I do sincerely mean IMO.  I'm not saying I'm right, and that everyone who 
disagrees must be wrong :)

Tim Anderson wrote:

> The main reason is that multiple parameters must
> be specified to generate sources for a particular schema.
> To specify these via properties would be ugly IMHO.
> 
> Your preferred approach only allows one schema per project,
> which is unrealistic.
> 
> -Tim
>  
> 
> 
>>-----Original Message-----
>>From: Nathan Coast [mailto:nathan@codeczar.com]
>>Sent: Friday, 10 October 2003 1:45 PM
>>To: Maven Users
>>Subject: castor plugin
>>
>>
>>Hi,
>>
>>Is there any reason why the castor plugin doesn't provide 'ready 
>>to go' jelly 
>>script?  What I mean by this is that in order to use the castor 
>>plugin you have 
>>to write maven.xml that sets properties then calls tags defined 
>>within the 
>>castor plugin.  Isn't the more 'normal' plugin mechanism to 
>>define executable 
>>jelly script that you configure with properties?
>>
>>would it be 'nicer' if the castor plugin did something like
>>
>>javac any java sources
>>generate sources from an xsd - default from say 
>>src/castor/${pom.id}.xsd to 
>>target/castor/java
>>add target/castor/java to compile.src.set
>>call java:jar to compile and assemble the ${maven.final.name}.jar?
>>
>>One thing I like about maven is that in general, if you place 
>>your sources in 
>>default locations, you don't have to write any jelly script or configure 
>>anything and the default goal for the plugin will do something sensible.
>>
>>More than happy to modify / patch the castor plugin if that's 
>>what people want.
>>
>>cheers
>>Nathan
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: castor plugin

Posted by Tim Anderson <tm...@netspace.net.au>.
Following up....

Ultimately, it would be nice to specify arbitrary artifacts
in the pom, to avoid hacking project.properties and maven.xml.
E.g:
   <artifact>
      <includes>
        <include>${basedir}/schemas/foo.xsd</include>
      </includes>
      <plugin>castor</plugin>
      <properties>
        <package>org.foo.bar</package>
        <types>j2</types>
      </properties>
   </artifact>

IIRC, changes to the pom to support this kind of thing have been discussed
before, but I can't find a link ATM.

-Tim


> -----Original Message-----
> From: Tim Anderson [mailto:tma@netspace.net.au]
> Sent: Friday, 10 October 2003 1:53 PM
> To: Maven Users List
> Subject: RE: castor plugin
>
>
> The main reason is that multiple parameters must
> be specified to generate sources for a particular schema.
> To specify these via properties would be ugly IMHO.
>
> Your preferred approach only allows one schema per project,
> which is unrealistic.
>
> -Tim
>
>
> > -----Original Message-----
> > From: Nathan Coast [mailto:nathan@codeczar.com]
> > Sent: Friday, 10 October 2003 1:45 PM
> > To: Maven Users
> > Subject: castor plugin
> >
> >
> > Hi,
> >
> > Is there any reason why the castor plugin doesn't provide 'ready
> > to go' jelly
> > script?  What I mean by this is that in order to use the castor
> > plugin you have
> > to write maven.xml that sets properties then calls tags defined
> > within the
> > castor plugin.  Isn't the more 'normal' plugin mechanism to
> > define executable
> > jelly script that you configure with properties?
> >
> > would it be 'nicer' if the castor plugin did something like
> >
> > javac any java sources
> > generate sources from an xsd - default from say
> > src/castor/${pom.id}.xsd to
> > target/castor/java
> > add target/castor/java to compile.src.set
> > call java:jar to compile and assemble the ${maven.final.name}.jar?
> >
> > One thing I like about maven is that in general, if you place
> > your sources in
> > default locations, you don't have to write any jelly script or
> configure
> > anything and the default goal for the plugin will do something sensible.
> >
> > More than happy to modify / patch the castor plugin if that's
> > what people want.
> >
> > cheers
> > Nathan
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: castor plugin

Posted by Tim Anderson <tm...@netspace.net.au>.
The main reason is that multiple parameters must
be specified to generate sources for a particular schema.
To specify these via properties would be ugly IMHO.

Your preferred approach only allows one schema per project,
which is unrealistic.

-Tim
 

> -----Original Message-----
> From: Nathan Coast [mailto:nathan@codeczar.com]
> Sent: Friday, 10 October 2003 1:45 PM
> To: Maven Users
> Subject: castor plugin
> 
> 
> Hi,
> 
> Is there any reason why the castor plugin doesn't provide 'ready 
> to go' jelly 
> script?  What I mean by this is that in order to use the castor 
> plugin you have 
> to write maven.xml that sets properties then calls tags defined 
> within the 
> castor plugin.  Isn't the more 'normal' plugin mechanism to 
> define executable 
> jelly script that you configure with properties?
> 
> would it be 'nicer' if the castor plugin did something like
> 
> javac any java sources
> generate sources from an xsd - default from say 
> src/castor/${pom.id}.xsd to 
> target/castor/java
> add target/castor/java to compile.src.set
> call java:jar to compile and assemble the ${maven.final.name}.jar?
> 
> One thing I like about maven is that in general, if you place 
> your sources in 
> default locations, you don't have to write any jelly script or configure 
> anything and the default goal for the plugin will do something sensible.
> 
> More than happy to modify / patch the castor plugin if that's 
> what people want.
> 
> cheers
> Nathan
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org