ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Sawatzky <>
Subject Zero-Padding an Int Ant Property
Date Thu, 24 Aug 2006 19:39:32 GMT
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 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:
For additional commands, e-mail:

View raw message