How do you use ant to unjar multiple JAR files and rebuild them into one JAR file?

Yes, it's possible with ant. A jar file is basically a zip with a special manifest file. So to unjar, we need to unzip the jars.

Ant includes an unzip task.

Up vote 8 down vote favorite 1 share g+ share fb share tw.

I would like to unjar multiple JAR files and then rebuild into one JAR using an ant build script. Is this possible? Ant jar unjar link|improve this question edited May 12 '10 at 22:35Cesar1,9481616 asked May 12 '10 at 22:23shelt5366123 0% accept rate.

Yes, it's possible with ant. A jar file is basically a zip with a special manifest file. So to unjar, we need to unzip the jars.

Ant includes an unzip task. To unzip/unjar all the jar files in your project: Obviously you need to declare ${build. Dir} and ${lib.

Dir} first. The line tells ant to include all files that end up with the jar extension, you can tweak that include to suit your needs. To pack everything into a jar, you use the jar task: In this example, we include different filesets.

In one fileset we are including all compiled classes. In another fileset we include two config files that this particular project depends upon.

Yes it is! You have two possibilities : Espen answer : One possible solution that creates one jar file from all the jar files in a given directory: This is useful if you don't need to exclude content that are in some jars (like for example some properties configuration file that might override yours, etc). Here the excludes properties is filtering out files from the dir property.

Use zipfileset The other solution is to use the zipfileset tag where the excludes property this time will filter out content from the jar to be merged. Of course you can combine the two tags (zipfileset and zipgroupfileset) inside the same jar tag to get the best of the two.

Yes, it's possible. One possible solution that creates one jar file from all the jar files in a given directory.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions