goelshek,

you can use this:

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

which in your case will produce

ant -Duser.property.file=foo.properties test

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

if in your properties file you define some properties
e.g.
prop1=foo
prop2=bar

then, you can access them in ant with
${prop1}
$[prop2}

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

hope this help

regards

supareno

When I run ant as follows:

ant -propertyfile <property file name> <target name>
e.g.
ant -propertyfile myProps.properties 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: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to