ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From supareno <>
Subject Re: How to access value of propertyfile command line inside script
Date Mon, 06 Apr 2009 19:56:32 GMT

you can use this:

ant -D<myproperty>=<myvalue> <target>

which in your case will produce

ant test

<?xml version="1.0"?>
<project name="testProps" default="test" basedir=".">
    <property file="${}"/>
    <target name="test">
       <echo>property file name: ${}</echo>

if in your properties file you define some properties

then, you can access them in ant with

your new target will look like this:
    <target name="test">
       <echo>property file name: ${}</echo>
       <echo>${prop1} and ${prop2}</echo>

hope this help



> When I run ant as follows:
> ant -propertyfile <property file name> <target name>
> e.g.
> ant -propertyfile test
> how do I find out the the name of the properties file that the user passed
> in the command line argument. So my ant script looks like:
> <?xml version="1.0"?>
> <project name="ant-test" basedir=".">
>   <target name="test">
>   <!-- I want to print/access the name of the property file passed on
> command line here.
>          Would like to do something like <echo message="${propertyfile}"/>
> -->
>   </target>
> </project>
> Essentially, is there a place/property where the command line argument is
> stored that can be accessed inside the script? I haven't been able to find
> anything so far in my search.
> Thanks.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message