Closed danieroux closed 5 years ago
Hi,
You can use the badigeon.uberjar/bundle
function to extract all resources from all dependencies
(clean/clean "target")
;; No need to compile clojure.core and clojure.main because their classes will be extracted by badigeon.uberjar/bundle
(compile/compile '[play.core]
{:compile-path "target/classes"
:compiler-options {:disable-locals-clearing false
:elide-meta [:doc :file :line :added]
:direct-linking true}
:classpath (classpath/make-classpath)})
(badigeon.uberjar/bundle
"target/play-uberjar"
{:deps-map (assoc (deps-reader/slurp-deps "deps.edn") :paths ["target/classes"]] )
:allow-unstable-deps? true})
(badigeon.zip/zip "target/play-uberjar" "target/play-uberjar.jar")
The ".clj" files of dependencies will be extracted too.
I just pushed a badigeon.uberjar/walk-directory
function on master that you can use to remove them:
(badigeon.uberjar/walk-directory
"target/play-uberjar"
(fn [dir f] (when (.endsWith (str f) ".clj")
(java.nio.file.Files/delete f))))
Does it solve your issue ?
Closing due to inactivity
This is like #3 - except I can't get it to work. I want no .clj files, ultimately. Not from dependencies or my code. badigeon.uberjar/bundle does not compile, so:
With this in user.clj:
And trying to invoke Java using the generates classes, I get:
This did work:
lib
.compile/extract-classes-from-dependencies
with:excluded-libs #{'org.clojure/clojure 'org.clojure/spec.alpha 'org.clojure/core.specs.alpha}
But it's not an uberjar, of course:
java -cp target/classes:lib/clojure-1.10.1.jar:lib/spec.alpha-0.2.176.jar:lib/core.specs.alpha-0.2.44.jar play.core