You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Randy Xu <r...@post.harvard.edu> on 2005/01/05 17:41:59 UTC

Variables in Maven

I don't have a terribly good grasp of Ant and now I'm converting a lot 
of ant scripts into Maven.  Is there a definitive guide to the 
differences between <property>, <attribute>, <param>, <j:set var>, the 
differences between them and the differences between Maven and Ant?  Is 
there one definitively better one to use for Maven?  How about testing 
for true, false and 'is set'?  And finally, how about reading from a 
.properties file with a variable=value pair on each line?

-Randy

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


Re: Variables in Maven

Posted by Randy Xu <r...@post.harvard.edu>.
Two additional questions:

1) Within a goal, I want to run something (in this case post-process) by 
default, unless the user doesn't want to.  I was thinking it could check 
a variable called skip_post_process.  If it's false or not set it rus 
the post-processor.  If it's true, it doesn't.  Any recommendations as 
to how this property should be set and checked - (the jelly if, ant 
property checking or something else)?  (have a different entry goal 
which sets it to true? have it be an -D variable?)
2) any better maven versions of?

    <condition property="build.os.type" value="unix">
      <os family="unix" />
    </condition>
    <condition property="build.os.type" value="windows">
      <os family="windows" />
    </condition>

AND

    <tstamp>
      <format property="build.timestamp" pattern="yyyy-MM-dd HH:mm:ss"/>
    </tstamp>


Randy Xu wrote:

> I don't have a terribly good grasp of Ant and now I'm converting a lot 
> of ant scripts into Maven.  Is there a definitive guide to the 
> differences between <property>, <attribute>, <param>, <j:set var>, the 
> differences between them and the differences between Maven and Ant?  
> Is there one definitively better one to use for Maven?  How about 
> testing for true, false and 'is set'?  And finally, how about reading 
> from a .properties file with a variable=value pair on each line?
>
> -Randy
>
> ---------------------------------------------------------------------
> 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: Variables in Maven

Posted by Brett Porter <br...@gmail.com>.
Try reading dIon Gillard's blog for some Jelly tips.


On Wed, 05 Jan 2005 11:41:59 -0500, Randy Xu <r...@post.harvard.edu> wrote:
> I don't have a terribly good grasp of Ant and now I'm converting a lot
> of ant scripts into Maven.  Is there a definitive guide to the
> differences between <property>, <attribute>, <param>, <j:set var>, 

I think attribute and param belong inside other elements.

j:set is what should be used in maven, though ant:property will be
passed through in a similar way if necessary.

> How about testing
> for true, false and 'is set'?  

${foo == 'true'} or ${foo}
${foo == 'false'} or ${!foo}
${foo != null} (note that empty is still set in this case)

> And finally, how about reading from a
> .properties file with a variable=value pair on each line?

If you read through the tag libraries on the Jelly site (particularly
core and util) you should be able to find what you need.

- Brett

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