Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

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

Jan Materne

2008-03-03


Author LoginPost Reply
<macrodef>
 <attribute name="" default=""/>


Jan

> -----Ursprüngliche Nachricht-----
> Von: leondz [mailto:leondz@(protected)]
> Gesendet: Montag, 3. März 2008 14:50
> An: user@(protected)
> 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 <leondz@(protected)>
> > 29.02.2008 12:51
> > Bitte antworten an
> > "Ant Users List" <user@(protected)>
> >
> >
> > An
> > user@(protected)
> > 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@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
> >
>
> --
> 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@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.