Leiningen has problems building a working uberjar
We're trying to build our Clojure project with Leiningen. We've succeeded in creating an uberjar by doing the following:
preconditions:
:main my-project.core
in project.clj -main
function (:gen-class :main true)
in core.clj procedure:
lein test
; completed with no failures lein deps
; completed successfully lein uberjar
java -jar BioClojure-1.0.0-SNAPSHOT-standalone.jar
, which resulted in this exception: Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
My research into this problem has not been fruitful. Apparently, it's a known problem with no good solution. I do not understand the answers there.
What do we need to do to get our uberjar working?
zip *-standalone.jar -d META-INF/DUMMY.SF
(I have no idea what this does) :uberjar-exclusions
in the project.clj file? (if so, what?) Lein and java versions:
$ lein version
Leiningen 1.6.1 on Java 1.6.0_26 Java HotSpot(TM) 64-Bit Server VM
Update: running the command suggested gives:
$ unzip -l BioClojure-1.0.0-SNAPSHOT-standalone.jar | grep -i -e ".sf"
49911 08-27-09 15:57 META-INF/RCSB-PDB.SF
0 03-23-10 08:21 META-INF/maven/net.sf.alxa/
0 03-23-10 08:21 META-INF/maven/net.sf.alxa/jlatexmath/
929 03-23-10 08:20 META-INF/maven/net.sf.alxa/jlatexmath/pom.xml
115 03-21-10 14:01 META-INF/maven/net.sf.alxa/jlatexmath/pom.properties
175241 08-17-11 20:25 META-INF/SELFSIGN.SF
0 09-21-09 06:45 META-INF/maven/net.sf.opencsv/
0 09-21-09 06:45 META-INF/maven/net.sf.opencsv/opencsv/
5510 09-21-09 06:44 META-INF/maven/net.sf.opencsv/opencsv/pom.xml
106 09-21-09 06:45 META-INF/maven/net.sf.opencsv/opencsv/pom.properties
My understanding from reading the comments in that issue is that your problem would go away if you add the following to your project.clj
:uberjar-exclusions [#"foo.sf"]
where foo.sf
is the particular .sf file you want to ignore from the jar. You can determine this by running:
unzip -l BioClojure-1.0.0-SNAPSHOT-standalone.jar | grep -i -e ".sf"
The suggested zip
command deletes the particular file from the jar (which is of the ZIP format).