File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes multiple jar creation for multiple directories Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "multiple jar creation for multiple directories" Watch "multiple jar creation for multiple directories" New topic
Author

multiple jar creation for multiple directories

senthil kumar
Greenhorn

Joined: Mar 19, 2008
Posts: 15
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

Joined: May 14, 2008
Posts: 5836
    
    7

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/


JBoss In Action
senthil kumar
Greenhorn

Joined: Mar 19, 2008
Posts: 15
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>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: multiple jar creation for multiple directories