> -----Original Message----- > From: Don Taylor [mailto:[EMAIL PROTECTED]] > Sent: 22 August 2001 16:05 > To: [EMAIL PROTECTED] > Subject: Re: User property overridden in nested ant scripts > > > > --- Will Dyke <[EMAIL PROTECTED]> wrote: > > I wish to use a command line property occasionally, > > to override that set in a 'wrapper' script, that > > in turn calls the main script. > > > > However, the property set in the wrapper script appears to > > override that set on the command line once the main > > script is called. > > > > As an example, I have two scripts, dummywrapper.xml, > > and dummy.xml > > > > ========== dummywrapper.xml =============== > > <project name="fakebuild" default="wrapper" basedir="."> > > <target name="wrapper"> > > <ant antfile="dummy.xml" target="build-deploy"> > > <property name="whoami" value="apps"/> > > </ant> > > </target> > > </project> > > > > The property element is embedded within the ant element. You are thus > specifying the value of the property whoami for the *spawned* ant. The > whoami property in the current execution is unaffected. Check > it out by > putting an echo after the ant task. > > Does anyone know if this would work: > > <project name="fakebuild" default="wrapper" basedir="."> > <target name="wrapper"> > <property name="whoami" value="apps"/> > <ant antfile="dummy.xml" target="build-deploy"> > <property name="whoami" value="${whoami}"/> > </ant> > </target> > </project> > > -- Don Actually, you don't need the <property ...> inside the <ant> tags So this works: <project name="fakebuild" default="wrapper" basedir="."> <target name="wrapper"> <property name="whoami" value="apps"/> <ant antfile="dummy.xml" target="build-deploy" inheritAll="true"/> </target> </project> I think I started writing these scripts before I understood ant's property inheritance rules. However, before this discussion, I certainly wasn't aware of this rule for spawned ants, but I can definitely see its use. Thanks again, Will This e-mail, and any attachment, is confidential. If you have received it in error, please delete it from your system, do not use or disclose the information in any way, and notify me immediately. The contents of this message may contain personal views which are not the views of the BBC, unless specifically stated.