ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: Calling targets and passing parms?!
Date Tue, 18 Dec 2007 06:43:29 GMT
> The ${label} parameter becomes set to "Release_2007_12_01_001" when
> the build script is executed. Even better, it cannot be reset via a
> <parameter> task. That means you could have a default value defined in
> your build file, and then have the command line value over ride it.


He meant <property> task instead of <parameter> ;)


> As I said before, you should set a default inside the build file, so
> if you don't provide a command line value, it will still have some
> sort of value.

If you dont know a good default and therefore rely on the "user input",
you could
do a 
   <fail unless="label">You must provide a 'label'</fail>
which causes the build to fail if you dont provide that property.


If you want to use "derived" values you could also provide a bunch of
property files
and load one of them using the given property. Again you should provide
defaults ...
   <property file="${label}.properties"/>
   <property file="default.properties"/>

Example:
   Release_2007_12_01_001.properties :
       version=2007.12
       release.manager=John Doe
   default.properties :
       name=${ant.project.name}
       version=${dstamp}
       release.manager=${user.name}
       company.name=ACME inc.
   build.xml
       ...
       <jar ...>
           <manifest>
               <attribute name="Built-By" value="${release.manager}"/>
               <attribute name="Implementation-Vendor"
value="${company.name}"/>
               <attribute name="Implementation-Title" value="${name}"/>
               <attribute name="Implementation-Version"
value="${version}"/> 



Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message