views:

605

answers:

2

I'm trying the following and it doesn't seem to work.

<property name="file.configs.txt" value="" />
...
<target name="...">
   <loadfile property="file.configs.txt" srcFile="remoteConfig/configs.txt" />
</target>

I read here that the <loadfile> task is supposed to load the contents of a file into the specified property.

+2  A: 

Properties are immutable in Ant. The first definition of file.configs.txt will prevent it from being set again.

From: http://ant.apache.org/manual/CoreTasks/property.html

Properties are immutable: whoever sets a property first freezes it for the rest of the build; they are most definitely not variables.

Nate
+1 Here's where this is documented: http://ant.apache.org/manual/CoreTasks/property.html
JeffH
Yup that was it! I defined the property before and I can't change the value. Thanks!
leeand00
+2  A: 

Get rid of the property definition line. Properties are immutable.

 <project name="foobar" default="foo">
   <target name="foo">
     <loadfile property="foo.bar" srcFile="foobar/moo.txt"/>
     <echo>${foo.bar}</echo>
   </target>
 </project>
seth