ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckn...@onebox.com
Subject RE: macrodef and classpath
Date Fri, 06 Feb 2009 21:24:39 GMT
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="QueryName=@{query-name}" />
				<arg value="QueryVersion=@{query-version}" />
				<arg value="bindvars=@{query-bind-variables}" />
				<arg value="XMLFileName=${xml.dir}/@{outfile}" />
			</java>
		</sequential>
	</macrodef>

Does that answer your question?
-- 
Charles Knell
cknell@onebox.com - email



-----Original Message-----
From:     Mark Waschkowski <mwaschkowski@gmail.com>
Sent:     Fri, 6 Feb 2009 16:16:13 -0500
To:       user@ant.apache.org
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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message