Flattening out a lib directory using jarjar

Posted by voodoogiant on Stack Overflow See other posts from Stack Overflow or by voodoogiant
Published on 2010-05-03T20:44:16Z Indexed on 2010/05/03 20:48 UTC
Read the original article Hit count: 166

Filed under:
|
|
|

I'm trying to flatten out the lib directory of a project using jarjar, where it will produce a jar file with my main code and all my required libraries inside of it. I can get the project code into the jar, but I need to find a way to get every jar in the './lib/' directory extracted to the base directory of the final output jar. I don't want it flattened in the sense that I still want the package hiearchy preserved. I could manually list every jar file using zipfileset, but I was hoping to do it dynamically. I would also like to include any *.so files flattened into the base directory of the output jar so I can extract them into a temp dir easily without having to search through the jar.

For example my lib directory...

./lib/library1.jar
./lib/library2.jar
./lib/foo/library3.jar
./lib/foo/bar.so

would look like this when cracked open in the output jar file...

/..library1_package_hierarchy../lib1.class
/..library1_package_heirarchy../lib2.class
         ... (and so on)
/..library2_package_hierarchy../lib1.class
/..library2_package_heirarchy../lib2.class
         ... (and so on)
/..library3_package_hierarchy../lib1.class <-- foo gone
/..library3_package_heirarchy../lib2.class <-- foo gone
/bar.so <-- foo gone

© Stack Overflow or respective owner

Related posts about jarjar

Related posts about jni