ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Agarkar, M (Milind)" <>
Subject RE: Passing properties as parameters to different targets in a build file
Date Tue, 04 Dec 2007 07:49:35 GMT
if you have log.dir read from the properties file, it is already set, so
you may not be able to set it again

We use something like this

<property file=../../>

<target name="start-all" description="...">
	<foreach list="${env.start}" param="${}"/>

You can either change name of the default property OR local property

-----Original Message-----
From: Shankar S [] 
Sent: 02 December 2007 21:58
To: Ant Users List
Subject: Passing properties as parameters to different targets in a
build file

Hi all,

I have a file that define a set of properties for my
build system.
log.dir and build.dir are defined in Based upon
user's confirguration these values are changed at build time.

My build.xml looks something like this:

<project name="TEST" default="Build_SS" basedir=".">
  <taskdef resource="net/sf/antcontrib/" />
  <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask"/>
  <!-- Set the environment to access the environment variables -->
  <property environment="env" />

  <!-- Set the project property file -->
  <property file="" />

  <!-- Update the timestamp -->

  <!-- Set up the build and log directories -->
   <equals arg1="${cvs.checkout}" arg2="true" />
   <equals arg1="${build.dir}" arg2="CVS_DIR" />
  <var name="build.dir" value="${root.dir}/${DSTAMP}_${TSTAMP}" />
  <var name="log.dir"
  <mkdir dir="${log.dir}" />
  <mkdir dir="${build.dir}" />
  <var name="build.dir" value="${local_root.dir}" />
  <var name="log.dir" value="${local_log.dir}" />  </else>
   <target name="Build_SS" >
   <equals arg1="${cvs.tag}" arg2="true" />
   *<antcall target="Tag_All_CVS_Modules">
*    <param name="log.dir" value="${log.dir}"/>

<target name="Tag_All_CVS_Modules" >
 <echo message="Log directory --> ${log.dir}" /> </target>

Firstly log.dir value is not being passed to target
*"Tag_All_CVS_Modules".* Secondly I tried passing the value using
<param/> but no luck with that either.

Is there a way to pass log.dir (and other properties) to different
targets in the same build file.

Thanks in advance;

This email (including any attachments to it) is confidential, legally privileged, subject
to copyright and is sent for the personal attention of the intended recipient only. If you
have received this email in error, please advise us immediately and delete it. You are notified
that disclosing, copying, distributing or taking any action in reliance on the contents of
this information is strictly prohibited. Although we have taken reasonable precautions to
ensure no viruses are present in this email, we cannot accept responsibility for any loss
or damage arising from the viruses in this email or attachments. We exclude any liability
for the content of this email, or for the consequences of any actions taken on the basis of
the information provided in this email or its attachments, unless that information is subsequently
confirmed in writing. If this email contains an offer, that should be considered as an invitation
to treat.

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

View raw message