ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Sawatzky <rsawat...@openfox.com>
Subject Re: Zero-Padding an Int Ant Property
Date Fri, 25 Aug 2006 14:32:04 GMT

Hi Antoine,

Thanks a whole lot!  That works perfectly!

Thanks again,
-Ryan

Antoine Levy-Lambert wrote:
> Hello Ryan,
>
> under "Optional Tasks" in the manual there is something called <propertyfile/>.
>
> it can format numbers, so this might be what you want.
>
> since its output is a file, you will need to load the generated property file after having
used <propertyfile/>
>
> so 
>
> <propertyfile file="some.generated.properties">
>   <entry  key="formated.int" type="int" value="${buildNum}" operation="=" pattern="0000"/>
> </propertyfile>
> <property file="some.generated.properties"/>
> <delete file="some.generated.properties"/>
>
> should do the job.
>
> Regards,
>
> Antoine
> -------- Original-Nachricht --------
> Datum: Thu, 24 Aug 2006 14:39:32 -0500
> Von: Ryan Sawatzky <rsawatzky@openfox.com>
> An: user@ant.apache.org
> Betreff: Zero-Padding an Int Ant Property
>
>   
>> Hello all,
>>
>> I have an Ant property file that contains a project build number 
>> property.  This build number is incremented every time the project is 
>> compiled.  I distribute my application as a versioned JAR file through 
>> Web Start, and I want to append the build number to the name of my JAR 
>> file.  For example, if my build number was 51, I want my JAR file to be 
>> named "myjar__V1.0051.jar".
>>
>> My ant command looks like this...
>>  <jar destfile="${dist.jar.dir}/myjar__V1.${buildNum}.jar" 
>> basedir="${build.classes.dir}" ................ />
>>
>> However, this generates a JAR file named "myjar__V1.15".  Is there 
>> anyway I can have ant zero-pad the build number property out to 4 
>> digits?  Or is there another way to do this?
>>
>> Thanks for any ideas,
>> -Ryan
>> -- 
>> / Ryan Sawatzky
>> Software Engineer
>> Computer Projects Of Illinois, Inc.
>> 6416 South Cass Ave.
>> Westmont, IL 60559
>> Pho: 630-968-0244 Ex 47.
>> Fax: 630-968-0481
>> /
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>   

-- 
/ Ryan Sawatzky
Software Engineer
Computer Projects Of Illinois, Inc.
6416 South Cass Ave.
Westmont, IL 60559
Pho: 630-968-0244 Ex 47.
Fax: 630-968-0481
/


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


Mime
View raw message