You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by leondz <le...@gmail.com> on 2008/02/29 12:46:58 UTC

How to execute a target multiple times, with different parameters

Hi,

I'm new to ant. I have a target in an existing project that looks like this:


        <target name="get-docs">
                        <fail unless="jar.present" message="TREC Apps cannot
be run until they have been built!"/>
                        <java fork="true"
classname="shef.qa.trec.GetRelevantDocuments">
                                <jvmarg
value="-Djava.library.path=/share/nlp.raid1/trec_qa/darwin/apps/indri-2.6/swig/obj/java"/>
                                <jvmarg value="-Xmx512m"/>
                                <jvmarg value="-Dgate.home=${gate.home}"/>
                                <jvmarg value="-Dnlp.plugins=${plugins}"/>
                                <jvmarg
value="-Dwordnet.home=${wordnet.home}"/>
                                <arg value="QA2006_testset.xml"/>
                                <arg value="QA2006_terrier"/>
                                <arg value="200"/>
                                <arg value="Terrier (AQUAINT)"/>
                                <classpath>
                                        <fileset file="${jar.file}"/>
                                        <fileset dir="${framework}">
                                                <include name="**/*.jar"/>
                                        </fileset>
                                        <fileset dir="${lib.shared}">
                                                <include name="**/*.jar"/>
                                        </fileset>
                                        <fileset dir="${plugins}">
                                                <include name="**/*.jar"/>
                                        </fileset>
                                </classpath>
                        </java>
        </target>



I want to run it a few times, using different values for the args. I don't
mind doing this from within ant, or from a shell script, but I'm not sure
how to automatically modify the arguments. What are the options?

Thanks!
-- 
View this message in context: http://www.nabble.com/How-to-execute-a-target-multiple-times%2C-with-different-parameters-tp15756893p15756893.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: How to execute a target multiple times, with different parameters

Posted by Alec Fernandez <Al...@sas.com>.
For example:

      <macrodef name="createRepository">
         <attribute name="host" default="${iomsrv.metadatasrv.host}" />
         <attribute name="port" default="${iomsrv.metadatasrv.port}" />
         <attribute name="user" default="${oma.person.admin.login.userid}" />
         <attribute name="password" default="${oma.person.admin.login.passwd}" />
         <attribute name="reposname" />
         <attribute name="repospath" />
         <attribute name="repostype" />
         <attribute name="reposiscm" default="YES" />
         <attribute name="reposDependencyList" default=" " />
         <attribute name="outputproperty" />
         <attribute name="resultproperty" />
         <attribute name="failonerror" default="true" />

         <sequential>

            <!-- use the metamgr utility to create repositories, redirect stdout to property and capture return code -->
            <java classname="com.sas.management.metadata.MetaMgrMain" classpath="${sas.launcher.jar.file}" fork="true" dir="${config.lev.logs.configure.dir}" failonerror="false" outputproperty="@{outputproperty}" resultproperty="@{resultproperty}">
               <jvmarg value="-Djava.system.class.loader=com.sas.app.AppClassLoader" />
               <jvmarg value="-Dsas.ext.config=${sas.ext.config.file}" />
               <jvmarg value="-Dsas.app.launch.config=${sas.metamgr.jar.picklist}" />
               <jvmarg value="-Dsas.app.repository.path=${install.vjr.repository.path}" />
               <arg value="-method" />
               <arg value="createRepository" />
               <arg value="-host" />
               <arg value="@{host}" />
               <arg value="-port" />
               <arg value="@{port}" />
               <arg value="-user" />
               <arg value="@{user}" />
               <arg value="-password" />
               <arg value="@{password}" />
               <arg value="-createReposPath" />
               <arg value="YES" />
               <arg value="-reposName" />
               <arg value="@{reposname}" />
               <arg value="-reposPath" />
               <arg value="@{repospath}" />
               <arg value="-reposEngine" />
               <arg value="BASE" />
               <arg value="-reposType" />
               <arg value="@{repostype}" />
               <arg value="-reposAccess" />
               <arg value="Online" />
               <arg value="-reposIsCM" />
               <arg value="@{reposiscm}" />
               <arg value="@{reposDependencyList}" />
            </java>
            <!-- send output from metadata deployment utility to log file -->
            <echo message="${@{outputproperty}}" />
            <echo level="verbose" message="Return Code: ${@{resultproperty}}" />

         </sequential>
      </macrodef>

Then call  it with:

            <createRepository reposname="${foundation.name}"
                repospath="${foundation.dir}"
                repostype="foundation"
                user="${login.userid}"
                password="${login.passwd}"
                outputproperty="Repository.log"
                resultproperty="Repository.rc"/>

>> -----Original Message-----
>> From: Gilles Scokart [mailto:gscokart@gmail.com]
>> Sent: Friday, February 29, 2008 7:07 AM
>> To: Ant Users List
>> Subject: Re: How to execute a target multiple times, with
>> different parameters
>>
>> I would suggest to use a macro instead of a target.
>>
>> Gilles
>>
>> On 29/02/2008, leondz <le...@gmail.com> wrote:
>> >
>> >
>> > Hi,
>> >
>> > I'm new to ant. I have a target in an existing project
>> that looks like
>> > this:
>> >
>> >
>> >         <target name="get-docs">
>> >                         <fail unless="jar.present"
>> message="TREC Apps
>> > cannot be run until they have been built!"/>
>> >                         <java fork="true"
>> > classname="shef.qa.trec.GetRelevantDocuments">
>> >                                 <jvmarg
>> > value="-
>> >
>> Djava.library.path=/share/nlp.raid1/trec_qa/darwin/apps/indri
>> -2.6/swig
>> > /obj/java
>> > "/>
>> >                                 <jvmarg value="-Xmx512m"/>
>> >                                 <jvmarg
>> value="-Dgate.home=${gate.home}"/>
>> >                                 <jvmarg
>> value="-Dnlp.plugins=${plugins}"/>
>> >                                 <jvmarg
>> > value="-Dwordnet.home=${wordnet.home}"/>
>> >                                 <arg value="QA2006_testset.xml"/>
>> >                                 <arg value="QA2006_terrier"/>
>> >                                 <arg value="200"/>
>> >                                 <arg value="Terrier (AQUAINT)"/>
>> >                                 <classpath>
>> >                                         <fileset
>> file="${jar.file}"/>
>> >                                         <fileset
>> dir="${framework}">
>> >                                                 <include
>> name="**/*.jar"/>
>> >                                         </fileset>
>> >                                         <fileset
>> dir="${lib.shared}">
>> >                                                 <include
>> name="**/*.jar"/>
>> >                                         </fileset>
>> >                                         <fileset dir="${plugins}">
>> >                                                 <include
>> name="**/*.jar"/>
>> >                                         </fileset>
>> >                                 </classpath>
>> >                         </java>
>> >         </target>
>> >
>> >
>> >
>> > I want to run it a few times, using different values for
>> the args. I
>> > don't mind doing this from within ant, or from a shell
>> script, but I'm
>> > not sure how to automatically modify the arguments. What
>> are the options?
>> >
>> > Thanks!
>> >
>> > --
>> > View this message in context:
>> >
>> http://www.nabble.com/How-to-execute-a-target-multiple-times%
>> 2C-with-d
>> > ifferent-parameters-tp15756893p15756893.html
>> > Sent from the Ant - Users mailing list archive at Nabble.com.
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional
>> > commands, e-mail: user-help@ant.apache.org
>> >
>> >
>>
>>
>> --
>> Gilles Scokart
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: How to execute a target multiple times, with different parameters

Posted by Gilles Scokart <gs...@gmail.com>.
I would suggest to use a macro instead of a target.

Gilles

On 29/02/2008, leondz <le...@gmail.com> wrote:
>
>
> Hi,
>
> I'm new to ant. I have a target in an existing project that looks like
> this:
>
>
>         <target name="get-docs">
>                         <fail unless="jar.present" message="TREC Apps
> cannot
> be run until they have been built!"/>
>                         <java fork="true"
> classname="shef.qa.trec.GetRelevantDocuments">
>                                 <jvmarg
> value="-
> Djava.library.path=/share/nlp.raid1/trec_qa/darwin/apps/indri-2.6/swig/obj/java
> "/>
>                                 <jvmarg value="-Xmx512m"/>
>                                 <jvmarg value="-Dgate.home=${gate.home}"/>
>                                 <jvmarg value="-Dnlp.plugins=${plugins}"/>
>                                 <jvmarg
> value="-Dwordnet.home=${wordnet.home}"/>
>                                 <arg value="QA2006_testset.xml"/>
>                                 <arg value="QA2006_terrier"/>
>                                 <arg value="200"/>
>                                 <arg value="Terrier (AQUAINT)"/>
>                                 <classpath>
>                                         <fileset file="${jar.file}"/>
>                                         <fileset dir="${framework}">
>                                                 <include name="**/*.jar"/>
>                                         </fileset>
>                                         <fileset dir="${lib.shared}">
>                                                 <include name="**/*.jar"/>
>                                         </fileset>
>                                         <fileset dir="${plugins}">
>                                                 <include name="**/*.jar"/>
>                                         </fileset>
>                                 </classpath>
>                         </java>
>         </target>
>
>
>
> I want to run it a few times, using different values for the args. I don't
> mind doing this from within ant, or from a shell script, but I'm not sure
> how to automatically modify the arguments. What are the options?
>
> Thanks!
>
> --
> View this message in context:
> http://www.nabble.com/How-to-execute-a-target-multiple-times%2C-with-different-parameters-tp15756893p15756893.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
Gilles Scokart

AW: Antwort: How to execute a target multiple times, with different parameters

Posted by Ja...@rzf.fin-nrw.de.
<macrodef>
   <attribute name="" default=""/>


Jan 

> -----Ursprüngliche Nachricht-----
> Von: leondz [mailto:leondz@gmail.com] 
> Gesendet: Montag, 3. März 2008 14:50
> An: user@ant.apache.org
> Betreff: Re: Antwort: How to execute a target multiple times, 
> with different parameters
> 
> 
> Hi,
> 
> This approach is working really well!
> 
> I've found that the target executing <antcall> contains a lot 
> of repeated
> code, though; is it possible to nest parameters?
> 
> For example, I have:
> 
> <target name="get-docs-all">
>         <antcall target="get-docs">
>                 < param name="questions" value="QA2006_testset.xml" />
>                 < param name="engine" value="Terrier (AQUAINT)" />
>                 < param name="output" value="QA2006_terrier" />
>                 < param name="maxdocs" value="200" />
>         </antcall>
>         <antcall target="get-docs">
>                 < param name="questions" value="QA2006_testset.xml" />
>                 < param name="engine" value="Lucene (AQUAINT)" />
>                 < param name="output" value="QA2006_lucene" />
>                 < param name="maxdocs" value="200" />
>         </antcall>
>         <antcall target="get-docs">
>                 < param name="questions" value="QA2006_testset.xml" />
>                 < param name="engine" value="Indri (AQUAINT)" />
>                 < param name="output" value="QA2006_indri" />
>                 < param name="maxdocs" value="200" />
>         </antcall>
> </target>
> 
> 
> Though something like the following would be preferred (the syntax is
> utterly wrong):
> 
> <target name="get-docs-all">
>         < param name="questions" value="QA2006_testset.xml" />
>         < param name="maxdocs" value="200" />
>         <antcall target="get-docs">
>                 < param name="engine" value="Terrier (AQUAINT)" />
>                 < param name="output" value="QA2006_terrier" />
>         </antcall>
>         <antcall target="get-docs">
>                 < param name="engine" value="Lucene (AQUAINT)" />
>                 < param name="output" value="QA2006_lucene" />
>         </antcall>
>         <antcall target="get-docs">
>                 < param name="engine" value="Indri (AQUAINT)" />
>                 < param name="output" value="QA2006_indri" />
>         </antcall>
> </target>
> 
> 
> Is this kind of structure achievable?
> 
> Thanks again for all your help!
> 
> All the best,
> 
> 
> Leon
> 
> 
> 
> Karl-Friedrich.Heintz wrote:
> > 
> > Hi,
> > 
> > call your 'get-docs' from another target via <antcall>  and 
> within this 
> > <antcall> you can use nested  elements, one for each argument  (see 
> > also ANT documentation).
> > 
> > Karl
> > 
> > 
> > 
> > 
> > leondz <le...@gmail.com> 
> > 29.02.2008 12:51
> > Bitte antworten an
> > "Ant Users List" <us...@ant.apache.org>
> > 
> > 
> > An
> > user@ant.apache.org
> > Kopie
> > 
> > Thema
> > How to execute a target multiple times, with different parameters
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > Hi,
> > 
> > I'm new to ant. I have a target in an existing project that 
> looks like 
> > this:
> > 
> > 
> >         <target name="get-docs">
> >                         <fail unless="jar.present" 
> message="TREC Apps 
> > cannot
> > be run until they have been built!"/>
> >                         <java fork="true"
> > classname="shef.qa.trec.GetRelevantDocuments">
> >                                 <jvmarg
> > 
> value="-Djava.library.path=/share/nlp.raid1/trec_qa/darwin/app
> s/indri-2.6/swig/obj/java"/>
> >                                 <jvmarg value="-Xmx512m"/>
> >                                 <jvmarg 
> value="-Dgate.home=${gate.home}"/>
> >                                 <jvmarg 
> value="-Dnlp.plugins=${plugins}"/>
> >                                 <jvmarg
> > value="-Dwordnet.home=${wordnet.home}"/>
> >                                 <arg value="QA2006_testset.xml"/>
> >                                 <arg value="QA2006_terrier"/>
> >                                 <arg value="200"/>
> >                                 <arg value="Terrier (AQUAINT)"/>
> >                                 <classpath>
> >                                         <fileset 
> file="${jar.file}"/>
> >                                         <fileset dir="${framework}">
> >                                                 <include 
> name="**/*.jar"/>
> >                                         </fileset>
> >                                         <fileset 
> dir="${lib.shared}">
> >                                                 <include 
> name="**/*.jar"/>
> >                                         </fileset>
> >                                         <fileset dir="${plugins}">
> >                                                 <include 
> name="**/*.jar"/>
> >                                         </fileset>
> >                                 </classpath>
> >                         </java>
> >         </target>
> > 
> > 
> > 
> > I want to run it a few times, using different values for 
> the args. I don't
> > mind doing this from within ant, or from a shell script, 
> but I'm not sure
> > how to automatically modify the arguments. What are the options?
> > 
> > Thanks!
> > -- 
> > View this message in context: 
> > 
> http://www.nabble.com/How-to-execute-a-target-multiple-times%2
> C-with-different-parameters-tp15756893p15756893.html
> > 
> > Sent from the Ant - Users mailing list archive at Nabble.com.
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> > 
> > 
> > 
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/How-to-execute-a-target-multiple-times%2
> C-with-different-parameters-tp15756893p15804282.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Antwort: Re: Antwort: How to execute a target multiple times, with different parameters

Posted by Ka...@gi-de.com.
Hi,

i think you should take 
        < param name="questions" value="QA2006_testset.xml" />
        < param name="maxdocs" value="200" />
not as 'param' but as normal properties.
Then they are visible within your target "get-docs-all"  and all called 
targets.

Karl



leondz <le...@gmail.com> 
03.03.2008 14:54
Bitte antworten an
"Ant Users List" <us...@ant.apache.org>


An
user@ant.apache.org
Kopie

Thema
Re: Antwort: How to execute a target multiple times, with different 
parameters







Hi,

This approach is working really well!

I've found that the target executing <antcall> contains a lot of repeated
code, though; is it possible to nest parameters?

For example, I have:

<target name="get-docs-all">
        <antcall target="get-docs">
                < param name="questions" value="QA2006_testset.xml" />
                < param name="engine" value="Terrier (AQUAINT)" />
                < param name="output" value="QA2006_terrier" />
                < param name="maxdocs" value="200" />
        </antcall>
        <antcall target="get-docs">
                < param name="questions" value="QA2006_testset.xml" />
                < param name="engine" value="Lucene (AQUAINT)" />
                < param name="output" value="QA2006_lucene" />
                < param name="maxdocs" value="200" />
        </antcall>
        <antcall target="get-docs">
                < param name="questions" value="QA2006_testset.xml" />
                < param name="engine" value="Indri (AQUAINT)" />
                < param name="output" value="QA2006_indri" />
                < param name="maxdocs" value="200" />
        </antcall>
</target>


Though something like the following would be preferred (the syntax is
utterly wrong):

<target name="get-docs-all">
        < param name="questions" value="QA2006_testset.xml" />
        < param name="maxdocs" value="200" />
        <antcall target="get-docs">
                < param name="engine" value="Terrier (AQUAINT)" />
                < param name="output" value="QA2006_terrier" />
        </antcall>
        <antcall target="get-docs">
                < param name="engine" value="Lucene (AQUAINT)" />
                < param name="output" value="QA2006_lucene" />
        </antcall>
        <antcall target="get-docs">
                < param name="engine" value="Indri (AQUAINT)" />
                < param name="output" value="QA2006_indri" />
        </antcall>
</target>


Is this kind of structure achievable?

Thanks again for all your help!

All the best,


Leon



Karl-Friedrich.Heintz wrote:
> 
> Hi,
> 
> call your 'get-docs' from another target via <antcall>  and within this 
> <antcall> you can use nested  elements, one for each argument  (see 
> also ANT documentation).
> 
> Karl
> 
> 
> 
> 
> leondz <le...@gmail.com> 
> 29.02.2008 12:51
> Bitte antworten an
> "Ant Users List" <us...@ant.apache.org>
> 
> 
> An
> user@ant.apache.org
> Kopie
> 
> Thema
> How to execute a target multiple times, with different parameters
> 
> 
> 
> 
> 
> 
> 
> Hi,
> 
> I'm new to ant. I have a target in an existing project that looks like 
> this:
> 
> 
>         <target name="get-docs">
>                         <fail unless="jar.present" message="TREC Apps 
> cannot
> be run until they have been built!"/>
>                         <java fork="true"
> classname="shef.qa.trec.GetRelevantDocuments">
>                                 <jvmarg
> 
value="-Djava.library.path=/share/nlp.raid1/trec_qa/darwin/apps/indri-2.6/swig/obj/java"/>
>                                 <jvmarg value="-Xmx512m"/>
>                                 <jvmarg 
value="-Dgate.home=${gate.home}"/>
>                                 <jvmarg 
value="-Dnlp.plugins=${plugins}"/>
>                                 <jvmarg
> value="-Dwordnet.home=${wordnet.home}"/>
>                                 <arg value="QA2006_testset.xml"/>
>                                 <arg value="QA2006_terrier"/>
>                                 <arg value="200"/>
>                                 <arg value="Terrier (AQUAINT)"/>
>                                 <classpath>
>                                         <fileset file="${jar.file}"/>
>                                         <fileset dir="${framework}">
>                                                 <include 
name="**/*.jar"/>
>                                         </fileset>
>                                         <fileset dir="${lib.shared}">
>                                                 <include 
name="**/*.jar"/>
>                                         </fileset>
>                                         <fileset dir="${plugins}">
>                                                 <include 
name="**/*.jar"/>
>                                         </fileset>
>                                 </classpath>
>                         </java>
>         </target>
> 
> 
> 
> I want to run it a few times, using different values for the args. I 
don't
> mind doing this from within ant, or from a shell script, but I'm not 
sure
> how to automatically modify the arguments. What are the options?
> 
> Thanks!
> -- 
> View this message in context: 
> 
http://www.nabble.com/How-to-execute-a-target-multiple-times%2C-with-different-parameters-tp15756893p15756893.html

> 
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-execute-a-target-multiple-times%2C-with-different-parameters-tp15756893p15804282.html

Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org



Re: Antwort: How to execute a target multiple times, with different parameters

Posted by leondz <le...@gmail.com>.
Hi,

This approach is working really well!

I've found that the target executing <antcall> contains a lot of repeated
code, though; is it possible to nest parameters?

For example, I have:

<target name="get-docs-all">
        <antcall target="get-docs">
                < param name="questions" value="QA2006_testset.xml" />
                < param name="engine" value="Terrier (AQUAINT)" />
                < param name="output" value="QA2006_terrier" />
                < param name="maxdocs" value="200" />
        </antcall>
        <antcall target="get-docs">
                < param name="questions" value="QA2006_testset.xml" />
                < param name="engine" value="Lucene (AQUAINT)" />
                < param name="output" value="QA2006_lucene" />
                < param name="maxdocs" value="200" />
        </antcall>
        <antcall target="get-docs">
                < param name="questions" value="QA2006_testset.xml" />
                < param name="engine" value="Indri (AQUAINT)" />
                < param name="output" value="QA2006_indri" />
                < param name="maxdocs" value="200" />
        </antcall>
</target>


Though something like the following would be preferred (the syntax is
utterly wrong):

<target name="get-docs-all">
        < param name="questions" value="QA2006_testset.xml" />
        < param name="maxdocs" value="200" />
        <antcall target="get-docs">
                < param name="engine" value="Terrier (AQUAINT)" />
                < param name="output" value="QA2006_terrier" />
        </antcall>
        <antcall target="get-docs">
                < param name="engine" value="Lucene (AQUAINT)" />
                < param name="output" value="QA2006_lucene" />
        </antcall>
        <antcall target="get-docs">
                < param name="engine" value="Indri (AQUAINT)" />
                < param name="output" value="QA2006_indri" />
        </antcall>
</target>


Is this kind of structure achievable?

Thanks again for all your help!

All the best,


Leon



Karl-Friedrich.Heintz wrote:
> 
> Hi,
> 
> call your 'get-docs' from another target via <antcall>  and within this 
> <antcall> you can use nested  elements, one for each argument  (see 
> also ANT documentation).
> 
> Karl
> 
> 
> 
> 
> leondz <le...@gmail.com> 
> 29.02.2008 12:51
> Bitte antworten an
> "Ant Users List" <us...@ant.apache.org>
> 
> 
> An
> user@ant.apache.org
> Kopie
> 
> Thema
> How to execute a target multiple times, with different parameters
> 
> 
> 
> 
> 
> 
> 
> Hi,
> 
> I'm new to ant. I have a target in an existing project that looks like 
> this:
> 
> 
>         <target name="get-docs">
>                         <fail unless="jar.present" message="TREC Apps 
> cannot
> be run until they have been built!"/>
>                         <java fork="true"
> classname="shef.qa.trec.GetRelevantDocuments">
>                                 <jvmarg
> value="-Djava.library.path=/share/nlp.raid1/trec_qa/darwin/apps/indri-2.6/swig/obj/java"/>
>                                 <jvmarg value="-Xmx512m"/>
>                                 <jvmarg value="-Dgate.home=${gate.home}"/>
>                                 <jvmarg value="-Dnlp.plugins=${plugins}"/>
>                                 <jvmarg
> value="-Dwordnet.home=${wordnet.home}"/>
>                                 <arg value="QA2006_testset.xml"/>
>                                 <arg value="QA2006_terrier"/>
>                                 <arg value="200"/>
>                                 <arg value="Terrier (AQUAINT)"/>
>                                 <classpath>
>                                         <fileset file="${jar.file}"/>
>                                         <fileset dir="${framework}">
>                                                 <include name="**/*.jar"/>
>                                         </fileset>
>                                         <fileset dir="${lib.shared}">
>                                                 <include name="**/*.jar"/>
>                                         </fileset>
>                                         <fileset dir="${plugins}">
>                                                 <include name="**/*.jar"/>
>                                         </fileset>
>                                 </classpath>
>                         </java>
>         </target>
> 
> 
> 
> I want to run it a few times, using different values for the args. I don't
> mind doing this from within ant, or from a shell script, but I'm not sure
> how to automatically modify the arguments. What are the options?
> 
> Thanks!
> -- 
> View this message in context: 
> http://www.nabble.com/How-to-execute-a-target-multiple-times%2C-with-different-parameters-tp15756893p15756893.html
> 
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-execute-a-target-multiple-times%2C-with-different-parameters-tp15756893p15804282.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Antwort: How to execute a target multiple times, with different parameters

Posted by Ka...@gi-de.com.
Hi,

call your 'get-docs' from another target via <antcall>  and within this 
<antcall> you can use nested <param> elements, one for each argument  (see 
also ANT documentation).

Karl




leondz <le...@gmail.com> 
29.02.2008 12:51
Bitte antworten an
"Ant Users List" <us...@ant.apache.org>


An
user@ant.apache.org
Kopie

Thema
How to execute a target multiple times, with different parameters







Hi,

I'm new to ant. I have a target in an existing project that looks like 
this:


        <target name="get-docs">
                        <fail unless="jar.present" message="TREC Apps 
cannot
be run until they have been built!"/>
                        <java fork="true"
classname="shef.qa.trec.GetRelevantDocuments">
                                <jvmarg
value="-Djava.library.path=/share/nlp.raid1/trec_qa/darwin/apps/indri-2.6/swig/obj/java"/>
                                <jvmarg value="-Xmx512m"/>
                                <jvmarg value="-Dgate.home=${gate.home}"/>
                                <jvmarg value="-Dnlp.plugins=${plugins}"/>
                                <jvmarg
value="-Dwordnet.home=${wordnet.home}"/>
                                <arg value="QA2006_testset.xml"/>
                                <arg value="QA2006_terrier"/>
                                <arg value="200"/>
                                <arg value="Terrier (AQUAINT)"/>
                                <classpath>
                                        <fileset file="${jar.file}"/>
                                        <fileset dir="${framework}">
                                                <include name="**/*.jar"/>
                                        </fileset>
                                        <fileset dir="${lib.shared}">
                                                <include name="**/*.jar"/>
                                        </fileset>
                                        <fileset dir="${plugins}">
                                                <include name="**/*.jar"/>
                                        </fileset>
                                </classpath>
                        </java>
        </target>



I want to run it a few times, using different values for the args. I don't
mind doing this from within ant, or from a shell script, but I'm not sure
how to automatically modify the arguments. What are the options?

Thanks!
-- 
View this message in context: 
http://www.nabble.com/How-to-execute-a-target-multiple-times%2C-with-different-parameters-tp15756893p15756893.html

Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org