Using Ant to create multiple jars
I have multiple Java eclipse projects. Each of them has a "jardesc" file to create a jar. That's good - double click -> finish and jar file. But when I have to export multiple cans it is a pain - I have to repeat the procedure several times. Please tell me if I can use an Ant script to run multiple jardesc files at once (and get multiple jars according to each jardesc file)? How to do it?
source to share
You can use the jar target to create the jars for you:
<jar destfile='destination.jar' basedir='source\dir\' />
so your build.xml file will look something like this:
<project default="makejars">
<target name="makejars">
<jar destfile="app1.jar" basedir="app1\src\" />
<jar destfile="app2.jar" basedir="app2\src\" />
<jar destfile="app3.jar" basedir="app3\src\" />
</target>
</project>
then just run ant in the same directory as build.xml and the jars should be done.
source to share
You can use some loops to create ant options, however, it is not possible to create a loop to create multiple jars (even with the ant -commons extension) copy and paste is the only viable solution if you don't want to write an ant plugin (actually not much 2 hours of reading documents + writing a simple plugin)
source to share