Automation using ANT - Reading from a file

[Source : http://wiki.apache.org/ant/AntTasks]

Problem Statement: To read value of a variable declared in input.properties within your build.xml

Assume there are two files:
[1] build.xml
[2] input.properties

 input.properties
build.xml
 <!-- AppServer Location -->
AS.DIR = /space/AS/appserver
 <property file="input.properties" prefix="input"/>
<echo>value of App Server directory is ${input.AS.DIR}</echo>
 

To reference the value AS.DIR which is present in input.properties ,you can use the <property> element with a <prefix> attribute from build.xml .


 

Comments:

Hi,

This is a very valuable tip. Would you mind answering
one more question please?

I have a file, which has names of testcases to be execu
-ted by JUnit test runner.

I need to read this file, and substitute them to the
ant task as test cases. Is there a way to do this using
ant tasks?

thanks and regards
Nitesh.

Posted by Nitesh on May 19, 2008 at 03:26 AM PDT #

isnt it different from this blog post that you are trying to achieve?

Posted by Thekkadath on May 19, 2008 at 01:58 PM PDT #

Yes, it is different but I was expecting the solution to be on
similar lines, i.e a way of substituting a dynamic variable with
names fetched from a file.

Thanks and regards
Nitesh

Posted by Nitesh on May 19, 2008 at 03:13 PM PDT #

Post a Comment:
Comments are closed for this entry.
About

I'm a Quality Engineer at Sun Microsystems. Here in this blog, you may find information about Software Testing, Portal Server, Virtualization, Web2.0 and Misc Technical topics. The views expressed here are personal and does not reflect that of my employer

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today