I have a build.xml where I put together some fat runnable jars with targets similar to:
<target name="create_myapp_jar">
<jar destfile="./production/myapp.jar" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="com.something.entrypoints.MyApp"/>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="./classes"/>
<zipfileset excludes="META-INF/*.SF" src="./lib/commons-cli-1.2.jar"/>
<zipfileset excludes="META-INF/*.SF" src="./lib/commons-codec-1.10-sources.jar"/>
<zipfileset excludes="META-INF/*.SF" src="./lib/commons-codec-1.10.jar"/>
<zipfileset excludes="META-INF/*.SF" src="./lib/commons-io-2.4.jar"/>
<zipfileset excludes="META-INF/*.SF" src="./lib/commons-lang-2.6.jar"/>
<zipfileset excludes="META-INF/*.SF" src="./lib/commons-pool2-2.2.jar"/>
lots and lots of more JARs here....
</target>
The code was generated by Eclipse (Export runnable Jar) and with minor changes by me.
The list of Jars that are included is quite long actually. I build several of these fat-jars, and I was wondering how I could avoid listing the <zipfileset>
statements for each target?
How can I smack them all together and then reference them from each fat-jar build target? All in the purpose of not letting my build.xml swell to hundreds and hundreds of lines. Also the pain of adding a new JAR to each of the targets would go away if I could have one definition somewhere.