looping in ant scripts

S

sri

this is the target in ant script to create a single jar file for a
module

<target name="deployjar">
<jar jarfile="${deploy}/PTS${moduleTitle}-${DSTAMP}-${TSTAMP}.jar" >
<fileset dir="${build}" >
<exclude name="${web}/**/*.*" />
</fileset>

<fileset dir="${src}\ejb\${moduleName}\META-INF" />
</jar>
</target>

the problem is i have 10 such modules
should i repeat this script for each of the 10 modules to create 10 jar
files or
is there some way to loop or invoke the target with different module
names
and create different jar with different module titles
if there is a way how can we pass different property values for each
invocation?
 
J

John C. Bollinger

sri said:
this is the target in ant script to create a single jar file for a
module
[...]

is there some way to loop or invoke the target with different module
names
and create different jar with different module titles
if there is a way how can we pass different property values for each
invocation?

Ant 1.6 has a macro feature that might get you where you want to go. If
you're using 1.6 then look up <MacroDef> among the core tasks.


John Bollinger
(e-mail address removed)
 
S

sri

this is the way i solved the problem using macrodef task


<macrodef name="testing">
<attribute name="moduleName" default="maintainrole"/>
<attribute name="moduleTitle" default="maintainrole"/>
<sequential>
<jar jarfile="${deploy}/PTS@{moduleTitle}-${DSTAMP}-${TSTAMP}.jar" >
<fileset dir="${build}" >
<exclude name="com/xxx/pms/web/" />
<include name="com/xxx/pms/ejb/@{moduleName}/**/*.*"/>
<include name="com/xxx/pms/lib/@{moduleName}/**/*.*"/>
</fileset>

<fileset dir="${src}/ejb/@{moduleName}" >
<include name="**/*.xml" />
</fileset>

</jar>
</sequential>
</macrodef>


<testing moduleName="maintainrole" moduleTitle="RoleModule">
</testing>

<testing moduleName="maintainactivity" moduleTitle="ActivityModule">
</testing>


thanks for ur reply john thanks for helping me out
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top