You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2003/05/07 16:14:19 UTC

DO NOT REPLY [Bug 19730] New: - only works once

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19730>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19730

<loadproperties> only works once

           Summary: <loadproperties> only works once
           Product: Ant
           Version: 1.5.3
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: mhilpert@gmx.de


I wrote a target that is intended to do the following thing:
1. read build number from build.number file and save to property
2. increase build number in build.number file
3. read new build number from build.number file and save to another property
4. take the two build numbers to replace the build number string in a 
Version.java file

------- ant target:
    <target name="increase build.number" depends="info" description="">
        <!-- get old build number: -->
        <loadproperties srcFile="${java}${file.separator}build.number"/>
        <property name="oldbn" value="BUILD_NUMBER = ${build.number}"/>
        <!-- increase build number in file build.number: -->
        <buildnumber file="${java}${file.separator}build.number"/>
        <!-- read build number into property: -->
        <loadproperties srcFile="${java}${file.separator}build.number"/>
        <property name="bn" value="BUILD_NUMBER = ${build.number}"/>
<echo message="Old bn=${oldbn} new bn=${bn}"/>
        <!-- update build number in Version class: -->
        <replace file="${src}${fs}de${fs}icomps${fs}amc${fs}amr${fs}
Version.java" token="${oldbn}" value="${bn}"/>
    </target>
-------

but the debug echo output is:

-------
increase build.number:
        [echo] Old bn=BUILD_NUMBER = 10 new bn=BUILD_NUMBER = 10
-------

and shows the old build.number value (in this example 10). It seems that the 
second call of <loadproperties> doesn't work because the property build.number 
has still the old value after second call of <loadproperties>.