ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nico Seessle" <>
Subject Re: javac task filtering
Date Sat, 30 Sep 2000 11:21:20 GMT
----- Original Message -----
From: "Paul Arzul" <>
To: <>
Sent: Friday, September 29, 2000 12:05 PM
Subject: javac task filtering

> aside: is there version numbering support in ant
> 1.2? something that could read a file, and auto increment a
> build number?

No direct support, but you can do something like this as follows:

- Read current value from property-file
- Increment value (or do anything else to them)
- write them back to the property-file
- use them

This example requires the script-task (and therefor BSF (bean scripting
framework) from IBM - last time I looked at there page it seemed to ba
available only by CVS...) and rhino (the Javascript-Engine) from

<?xml version="1.0"?>
<project name="myProject" default="default" basedir=".">

    <target name="default">
       <property file=""/>

       <script language="javascript"> <![CDATA[
           var buildNumber = parseInt(myProject.getProperty('buildNumber'));
// get current value
           if (isNaN(buildNumber)) buildNumber = 0;  // if not a number (no
value) initialize to zero
           buildNumber = buildNumber + 1; // Increment by one
           myProject.setProperty('buildNumber', buildNumber); // and put

       <echo file="">## Automatically generated.
## Do not modify!

          This is Build ${buildNumber}



View raw message