You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Cam <cm...@gmail.com> on 2008/02/02 22:47:15 UTC

pom scripting tools?

hi,

i was wondering if there's any way to do simple scripting in a pom? the 
specific case i'm trying to solve is to generate a database schema name 
based on the version of the project. If my project version is 
0.1-SNAPSHOT i'd like the database to be called 0_1_snapshot since '.' 
and '-' are restricted characters in postgres. i think scripting would 
be the only way to accomplish this otherwise i would have to manually 
set the new database name with every version change.

another case i've got is where i want to negate a boolean property - 
this is in  the case of the sql plugin which has a 'skip' config 
parameter, in my case i want to have a property called 
'init.database.user' which has requires a property of true to activate 
instead of 'init.database.user.skip' which would require a false value. 
trivial i know, but i think it makes the properties a bit more 
intuitive. is there any way i can do boolean operators on properties, 
something like:

<init.database.user.skip>!${init.database.user}</init.database.user.skip>

thanks,
cam


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


Re: pom scripting tools?

Posted by Wayne Fay <wa...@gmail.com>.
You could probably achieve this with a little Beanshell or Groovy
plugin, or Java for that matter. You'd need to bind the property back
to the MavenProject so it would propagate throughout your build.

Wayne

On 2/2/08, Cam <cm...@gmail.com> wrote:
> hi,
>
> i was wondering if there's any way to do simple scripting in a pom? the
> specific case i'm trying to solve is to generate a database schema name
> based on the version of the project. If my project version is
> 0.1-SNAPSHOT i'd like the database to be called 0_1_snapshot since '.'
> and '-' are restricted characters in postgres. i think scripting would
> be the only way to accomplish this otherwise i would have to manually
> set the new database name with every version change.
>
> another case i've got is where i want to negate a boolean property -
> this is in  the case of the sql plugin which has a 'skip' config
> parameter, in my case i want to have a property called
> 'init.database.user' which has requires a property of true to activate
> instead of 'init.database.user.skip' which would require a false value.
> trivial i know, but i think it makes the properties a bit more
> intuitive. is there any way i can do boolean operators on properties,
> something like:
>
> <init.database.user.skip>!${init.database.user}</init.database.user.skip>
>
> thanks,
> cam
>
>
> ---------------------------------------------------------------------
> 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