Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multiple jar creation for multiple directories

 
senthil kumar
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my src area i have some 10 packages of which I am trying to create 10 different jars, currently in the ant script I have 10 such jar creation task, except the jar name in the task input directory output directory every thing is same, IS there a way instead of having 10 different task, can I have the packages names in properties file and pass them into script. Meaning my ant script will have only one jar creation script but gets the package names from properties file and do this in a loop. Any thoughts??
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could do this with an <antcall> for each JAR. You might also want to use one of the looping mechanisms available in the ant-contrib extensions.
http://ant-contrib.sourceforge.net/
 
senthil kumar
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply, but I also tried below code and it worked like a charm.

<macrodef name="buildJavaJar" >
<attribute name="build.directory" />
<sequential>
<jar jarfile="${build.dir}/@{build.directory}.jar" basedir="${build.classes.dir}/@{build.directory}" />
</sequential>
</macrodef>

<target name="abc.jar" depends="compile">
<buildEjbJar build.directory="abc" />
</target>

<target name="def.jar" depends="compile">
<buildEjbJar build.directory="def" />
</target>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic