I’m trying to read the “Application.revision” property from a application.properties file into a variable called “svna.version” before my buildscript tries to set a variable. On some of my systems I don’t have a svn client so svnversion fails and it goes blank. instead of failing, I want it to be the last known value.
How do I set svna.version? I’m trying to do something like this
<propertyfile file="src/CASUAL/resources/CASUALApp.properties"/>
<property name="svna.version" value="${Application.revision}"/>
I just need to know how to read a property into an Ant variable. the value is not read from the properties file in the example above. it’s read as a literal string.
As requested I am adding in the contents of my properties file:
Application.name=CASUAL
Application.title=CASUAL R
Application.version=${Application.revision}.${Application.buildnumber}
Application.vendor=AdamOutler
Application.homepage=xda-developers.com
Application.description=CASUAL Cross-platform ADB Scripting Universal Android Loader
Application.vendorId=AdamOutler
Application.id=${Application.name}
Application.lookAndFeel=system
Application.buildnumber=2,888
Application.revision=254
I need to read the Application.revision into the Property “svna.version” but it’s reading as a literal string instead of a key-value pair.
Ok – just spotted it. You need to use
<loadproperties/>or<property file="foo.properties"/>The task you’re using is for writing properties files not loading them.Loading properties here or indeed here
Writing properties here
Running ant with -d and -v are very helpful here.