You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Mark Crocker <mc...@markcrocker.com> on 2003/05/15 01:49:12 UTC

How do I unjar multiple jar files in place?

How does one use ANT to unjar a collection of jar files, each one independently of the rest?

The unjar task seems to allow the selection of multiple sources, but not multiple destinations.  I have successfully used the copy task with a fileset and mapper to get each jar into it's own directory, but how do I get each one unjar'ed once isolated?

My jars are from several different authors and many are obfuscated, so there are lots of a.class, b.class etc... and conflicting library versions.  These jars need to be expanded so that the contents can be used as sample data for my test fixture.  Since their namespaces must be preserved and identically named files must not over write each other, I need to be able to unjar each jar independently into the directory that I created for it with the copy.

The only thing I can think of is to write a fileset to a file and manipulate the file into an ant file using filterchains so that each file name is embedded into an unjar subtask so I can finally use antcall to run it.  That seems awfully complicated.  There has got to be a better way.  Any suggestions?

           __    
     __   / /\   
    /  /\/ / /_  ------------------------------------
   /  /  \/ / /\ Mark Crocker                        
  /  / /\ \ \/ / mcrocker@markcrocker.com            
 /  /  \_\/\  /  http://www.markcrocker.com/~mcrocker
/__/ /\ \ \_\/   ------------------------------------
\  \ \_\/        
 \  \ \          
  \__\/