The variable is defined in the build.xml file. The only thing the macrodef file needs to have in advance in the name of the attribute, not the value. -- Charles Knell [email protected] - email
-----Original Message----- From: Mark Waschkowski <[email protected]> Sent: Fri, 6 Feb 2009 16:28:38 -0500 To: Ant Users List <[email protected]> Subject: Re: macrodef and classpath Hi, Thanks, but no. I have my macrodefs stored in one file, and I import it in the 'real' build file like so: <import file="${base.dir}/buildMacros.xml"/> I want to pass in my 'real' build properties to the macrodefs without defining values in the macrodef file. This works using elements, but not with attributes - am I missing something? As well, I'm wondering what other kinds of reuse approaches there are? Thanks, Mark On Fri, Feb 6, 2009 at 4:24 PM, <[email protected]> wrote: > I set up properties > > <property name="" value=""/> > > in the "init" target and use references to them in the macrodefs. > > Here's an example > <target name="init"> > <property name="oracle.xml.parser.jar.path" > value="C:/oracle/ora90JavaXDK/lib/xmlparserv2.jar" /> > </target> > > I then refer to the property in the macrodef > > ex. > > <macrodef name="get-data-as-xml"> > <attribute name="query-name" /> > <attribute name="query-version" /> > <attribute name="query-bind-variables" default="" /> > <attribute name="outfile" /> > <sequential> > <!-- Execute the query, store results in XML file > --> > <java classname="gov.dhs.ice.sarsj.FetchDataAsXML" > fork="true" maxmemory="256m"> > <classpath> > <pathelement > location="${oracle.jdbc.jar.path}" /> > <pathelement > location="${sars.jar.path}" /> > <pathelement > location="${oracle.xsu12.jar.path}" /> > <pathelement > location="${oracle.xml.parser.jar.path}" /> > </classpath> > <arg > value="QueryFileName=${sql.dir}/${query.file}" /> > <arg value="queryna...@{query-name}" /> > <arg value="queryversi...@{query-version}" > /> > <arg > value="bindva...@{query-bind-variables}" /> > <arg > value="XMLFileName=${xml.dir}/@{outfile}" /> > </java> > </sequential> > </macrodef> > > Does that answer your question? > -- > Charles Knell > [email protected] - email > > > > -----Original Message----- > From: Mark Waschkowski <[email protected]> > Sent: Fri, 6 Feb 2009 16:16:13 -0500 > To: [email protected] > Subject: macrodef and classpath > > Hi all, > First time poster, hi! Thanks to the devs for ant, been using it for years > now. I tried to do something new by creating a macrodef, but ran into some > problems with passing in a classpath, and didn't see any solutions having > gone through the mailing list archive. I've created a separate file that > contains several macrodefs (I'm planning on importing the macrodefs in a > few > different projects), and I'm trying to pass in a classpath with an > attribute. That didn't work, so tried using the element tag and it did. Is > there any way to do this with an attribute? > > I'm I do things the Ant way by creating a separate macrodefs file, or might > this lead to issues? > > Thanks very much! > > Mark > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
