Fork me on GitHub
#leiningen
<
2021-08-07
>
rkiouak22:08:19

I am trying to figure out how to exclude dependencies marked as :scope “provided” from the output of lein uberjar (specifically for this project: https://github.com/protojure/lib). IIUC the output of lein deps :tree , core.async is the only reference to tools.analyzer, and both show as :scope “provided:

matthewrkiouak@Matthews-MacBook-Air lib % lein deps :tree | grep -A 5 -B 5 tools
--
 [org.apache.commons/commons-compress "1.20"]
 [org.clojure/clojure "1.10.3" :scope "provided"]
   [org.clojure/core.specs.alpha "0.2.56" :scope "provided"]
   [org.clojure/spec.alpha "0.2.194" :scope "provided"]
 [org.clojure/core.async "1.3.610" :scope "provided"]
   [org.clojure/tools.analyzer.jvm "1.1.0" :scope "provided"]
     [org.clojure/core.memoize "1.0.236" :scope "provided"]
       [org.clojure/core.cache "1.0.207" :scope "provided"]
         [org.clojure/data.priority-map "1.0.0" :scope "provided"]
but running:
lein uberjar && cd scratch
unzip ../target/protojure-1.6.1-SNAPSHOT-standalone.jar > output.txt
cat output.txt | grep tools
shows:
....
inflating: clojure/tools/analyzer$parse_invoke.class
  inflating: clojure/tools/reader$read_unicode_char.class
  inflating: clojure/tools/analyzer$analyze_fn_method$fn__934.class
  inflating: clojure/tools/analyzer$parse_fn_STAR_$fn__946.class
  inflating: clojure/tools/reader$macros.class
  inflating: clojure/tools/analyzer$parse_recur.class
  inflating: clojure/tools/reader$ending_line_col_info.class
  inflating: clojure/tools/reader$resolve_symbol.class
  inflating: clojure/tools/analyzer$validate_bindings.class
  inflating: clojure/tools/analyzer$fn__737.class
  inflating: clojure/tools/analyzer$fn__756.class
  inflating: clojure/tools/reader$read_dispatch.class
  inflating: clojure/tools/logging$eva
....
What am I doing wrong?

rkiouak23:08:27

So the :scope “provided” dependencies seem to only be included on the classpath when some of the nses use gen-class and require AOT compilation. Would anyone be able to explain why the behavior is this way?