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, <ckn...@onebox.com> 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
> ckn...@onebox.com - email
>
>
>
> -----Original Message-----
> From:     Mark Waschkowski <mwaschkow...@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-unsubscr...@ant.apache.org
> For additional commands, e-mail: user-h...@ant.apache.org
>
>

Reply via email to