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]