ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alec Fernandez <Alec.Fernan...@sas.com>
Subject RE: How to execute a target multiple times, with different parameters
Date Fri, 29 Feb 2008 13:00:00 GMT
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 <leondz@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


Mime
View raw message