Trying jwrapper on a project, it fails like so:
**********************************
* BUILD FAILED *
**********************************
** Reason: (see stacktrace below)
java.lang.IllegalArgumentException: Non-empty directory: META-INF/services
at com.sun.java.util.jar.pack.PackerImpl$DoPack.readFile(PackerImpl.java:546)
at com.sun.java.util.jar.pack.PackerImpl$DoPack.run(PackerImpl.java:492)
at com.sun.java.util.jar.pack.PackerImpl.pack(PackerImpl.java:99)
at jwrapper.pack200.Pack200Compressor.compressFileToOutputStream(Pack200Compressor.java:133)
at jwrapper.archive.Archive.addFileToStream(Archive.java:411)
The application jar has this:
1 12-03-2014 16:45 META-INF/services/
13 12-03-2014 16:45 META-INF/services/java.sql.Driver
What could the problem be?
The same errors is thrown if running pack200 stand-alone. I don't know what's special about META-INF/services. Many other directories are handled without error.
Update:
Just found unzip has a 'verbose' flag, which reveals this oddity:
0 Stored 0 0% 02-22-2013 13:53 00000000 META-INF/maven/net.mikera/mathz/
1 Defl:N 3 -200% 12-03-2014 16:45 32d70693 META-INF/services/
All the directories are marked 'Stored', except META-INF/services/. However I don't know why or how.
This seems to be unrelated to jwrapper. The clojure uberjar tool, lein, sometimes builds a jar that is incompatible with pack200. It only happens with certain upstream jars, and certain jdk versions (1.7).
A work-around is to unzip/re-zip the clojure uberjar, which fixes the directory structure. This should be done before invoking jwrapper.