r0man/inflections-clj

lein uberjar broken

andrusieczko opened this issue · 4 comments

Hey,

First of all - thanks for the library, it's great!

Unfortunately, I can't use it on prod - when I'm trying to run lein uberjar and then java -jar my-project.jar, it shouts:

Error: Invalid or corrupt jarfile my-project.jar

I've checked it carefully, with clean project (just one .clj file) - it's working without [inflections "0.9.13"] dependency and it breaks after addition.

Do you need any more information from my side?

Thanks,
Karol

Hey @andrusieczko, not sure what's wrong. Do you have an example repo somewhere that shows this issue?

Hey @r0man. I'm sorry, it was not caused by your library... To be honest, I don't really understand what's going on. It seems that lein uberjar's behavior is not deterministic... That's the list of my dependencies:

             ; web libraries
             [ring/ring "1.3.2"]
             [ring/ring-json "0.3.1"]
             [compojure "1.3.2"]
             [liberator "0.12.0"]
             [lib-noir "0.9.9"]

             ; middlewars
             [ring-json-params "0.1.3"]
             [ring.middleware.logger "0.5.0"]

             ; json util
             [org.clojure/data.json "0.2.5"]

             ; http connections
             [http-kit "2.1.16"]
             [clj-http "1.0.1"]

             ; databases
             [clojurewerkz/cassaforte "2.0.0"]
             [clojurewerkz/elastisch "2.2.0-beta1"]
             [korma "0.4.0"]
             [org.postgresql/postgresql "9.2-1002-jdbc4"]

             ; immutant
             [org.immutant/web "2.0.0-beta2"]
             [org.immutant/caching "2.0.0-beta2"]
             [org.immutant/messaging "2.0.0-beta2"]
             [org.immutant/scheduling "2.0.0-beta2"]
             [org.immutant/transactions "2.0.0-beta2"]

             ; cassandra tests
             [org.cassandraunit/cassandra-unit "2.1.3.1"]
             ; needed for cassandra-unit
             [com.google.guava/guava "18.0"]
             [org.clojars.pierrehenryperret/jackson-core-asl "1.9.4"]

             ; misc
             [metrics-clojure "2.4.0"]
             [danlentz/clj-uuid "0.1.5"]
             [inflections "0.9.13"] 

I was experimenting... just commenting out some libraries, at first I narrowed it down just to your library, then it appeared that it worked, then with some sets of libraries it doesn't work but with others do... There are too many combinations of what could have gone wrong...

Anyway, if you have any idea how to narrow down the problem, I'd be grateful. If not, no worries, the issue should be closed.

BTW: after commenting out all the immutant libraries except web, it works... Hopefully this one will be deterministic...

I'm sorry for such a confusion!

No worries. One thing I do in these kind of situations is wiping out my ~/.m2 directory. Maybe that helps ... :)

amoe commented

I'd speculate that this was probably down to this bug in Java 7, and not due to clj-pdf: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7191282

This would explain the nondeterministic behaviour, as including different sets of dependencies would lead to different total numbers of classes being included in the resulting uberjar. It also explains why the OP implies that this is only happening on the production server (that may run an older JVM version).