ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conelly, Luis (PS, GNF, Contractor)" <Luis.Cone...@gnf.com>
Subject RE: ant and cvs
Date Mon, 19 Jan 2004 14:17:13 GMT
I think this involves the way java handles the properties files. 
Take a look at java.util.Properties#load(java.io.InputStream) [1]. There's some info about
how to properties files are handled by Java. 

The manual for Ant 1.6 shows the behavior of PropertyFile[2], but it doesn't say how to fix
it =(

I think you could load the properties file after editing with Property[3] and then use in
your build file

It is not too much, but a good place to start

Regards
-Luis

---------------------
[1] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html#load(java.io.InputStream)
[2] http://ant.apache.org/manual/OptionalTasks/propertyfile.html
[3] http://ant.apache.org/manual/CoreTasks/property.html





-----Original Message-----
From: Walter Moore [mailto:wbmoore@fedex.com]
Sent: Monday, January 19, 2004 7:29 AM
To: Ant Users List
Subject: ant and cvs


Hi all. I'm new to building ant build.xml files.

I'm trying to build a mechanism in the build file that wil allow me to 
check out a tagged file and grab the tag from a version.properties file.

I have these lines in the file:
version=$Name: $
author=$Author: $

Now the Name is expanded to the name of the tag and the Author is 
expanded to the username when I delete the file and check it out again 
using the tag -- IF I use wincvs. so these lines look like this:
version=$Name: This-Is-My-Tag $
author=$Author: myUserName $

That works ok. My problem comes in when I try to do the same thing using 
ant 1.6.0.
These lines get expanded like:
version=$Name\: This-Is-My-Tag $
author=$Author\: myUserName $

Now, if I check this in and then do a check out again of this file, The 
$Name: $ and $Author: $ keywords do not get expanded, because they have 
'\:' instead of ':'.

This contains the interesting lines of my build file:
==================================================
<!--  Create new version.properties and delete tag files -->
    <target name="makeversion" description="create the needed files so 
jar will have tag within it.">
<!-- Get a build time -->
    <tstamp>
           <format property="buildtime.isoformat" 
pattern="yyyy-MM-dd'T'HH:mm:ss"/>
    </tstamp>
    <!--  Modify the properties file by incrementing the build number 
and the build time -->
    <delete file="${src}/version.properties"/>
    <cvs command="update version.properties"/>
    <propertyfile file="version.properties" comment="Version properties">
              <entry key="release" type="int" operation="+" default="0"/>
              <entry key="build" type="int" value="0"/>
              <entry key="build.time" type="string" 
value="${DSTAMP}_${TSTAMP}"/>
     </propertyfile>
     <!-- Load the new properties -->
     <property file="version.properties" prefix="version"/>
</target>
====================================================

How do I fix this?

Thanks.
Walter Moore



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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message