Reputation: 5667
I am trying to make a Ant script that would promote the SA for some values and it would add them to files. If you run the following script the property name gets added to the files not the value?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="run-count" name="run">
<!--this file was created by Eclipse Runnable JAR Export Wizard-->
<!--Ant 1.7 is required
-->
<target name="run-count">
<input
message="Please enter db-username:"
addproperty="db.user"
/>
</target>
<concat destfile="input.txt" append="true">"${db.user}"</concat>
<echo file="file.txt" append="true">
<![CDATA[
<h1>"${db.user}"</h1>
]]>
</echo>
</project>
Upvotes: 0
Views: 209
Reputation: 16235
The problem is that you output to the file outside the scope of the target in which the property is set.
The content outside any target is executed first.
So it means that the file output is already done before you have prompted for the user to input the username.
Solutions...
concat
and echo
inside your run-count
target, orrun-count
, orinput
element before them, outside any target.Upvotes: 1