We’re trying to build our Clojure project with Leiningen. We’ve succeeded in creating an uberjar by doing the following:
preconditions:
- project.clj file lists dependencies
:main my-project.corein project.clj- a core.clj file with a
-mainfunction (:gen-class :main true)in core.clj
procedure:
- ran
lein test; completed with no failures - ran
lein deps; completed successfully - from project.clj’s directory: rain
lein uberjar - This created two jar files: My-Project-1.0.0-SNAPSHOT-standalone.jar, and My-Project-1.0.0-SNAPSHOT.jar.
- ran
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?
- determine which of our dependencies is causing the problem?
- remove dependencies from our project?
- compile the project some other way?
- patch leiningen?
- use the suggested command:
zip *-standalone.jar -d META-INF/DUMMY.SF(I have no idea what this does) - do something with
:uberjar-exclusionsin 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.cljwhere
foo.sfis the particular .sf file you want to ignore from the jar. You can determine this by running:The suggested
zipcommand deletes the particular file from the jar (which is of the ZIP format).