lein-tools-deps icon indicating copy to clipboard operation
lein-tools-deps copied to clipboard

uberjar question

Open danoyoung opened this issue 5 years ago • 3 comments

This is a newbie question, trying to use the lein-tool-deps with my project, but I can't seem to get the uberjar part to work. When I run lein uberjar, I see the target directiory and the SNAPSHOT.jar file, but it just keeps growing and growing. I finally kill it after 10GB or so. When I just use lein dependencies w/o lein-tools-deps, the uberjar is created.... Any idea with what I might be doing wrong?

Here's my project.clj

(defproject dlp-inspect "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  ; NOTE: the deps are managed via deps.edn and the lein-tools-deps plugin...
  ;;:dependencies [[org.clojure/clojure "1.9.0"]
  ;;               [datasplash "0.6.3"]
  ;;               [clj-time "0.15.0"]]
  ;;:dependencies []
  :plugins [[lein-tools-deps "0.4.1"]]
  :middleware [lein-tools-deps.plugin/resolve-dependencies-with-deps-edn]
  :lein-tools-deps/config {:config-files [:install :user :project "./deps.edn"]
                           :clojure-executables ["/usr/local/bin/clojure"]}
  :clean-targets ^{:protect false} [...targets...]
  :profiles {:dev {:global-vars {*warn-on-reflection* false}}}
  :uberjar-name "dlp-inspect.jar"
  :manifest {"Class-Path" "."}
  :jvm-opts ["-Xms2g" "-server" "-Xmx4g"]
  :tar {:uberjar true}
  :jar-exclusions [#".DS_Store"]
  :uberjar-exclusions [#".DS_Store" #"META-INF/*.DSA" #"META-INF/*.RSA" #"META-INF/*.SF" #"META-INF/LICENSE"]
  :min-lein-version "2.8.0"
  :aot :all
  :main dlp-inspect.core)

My deps.edn

{
 :paths ["src" "target" "resources"]
 ;; External dependencies
 :deps          {
                 org.clojure/clojure {:mvn/version "1.9.0"}
                 org.clojure/tools.cli {:mvn/version "0.4.1"}
                 clj-time {:mvn/version "0.15.0"}
                 datasplash {:mvn/version "0.6.3" :exclusions [io.grpc/grpc-core]}}


 :mvn/repos     {"central" {:url "https://repo1.maven.org/maven2/"}
                 "clojars" {:url "https://clojars.org/repo"}}}

danoyoung avatar Dec 05 '18 13:12 danoyoung

You have a lot of properties configuring leiningen and the uberjar... does it do it if you cut this down?

RickMoynihan avatar Dec 05 '18 17:12 RickMoynihan

This is what I have now;

when I run lein uberjar, seems to be spinning and the dlp-inspect-0.1.0-SNAPSHOT.jar just keeps growing and growing, finally kill is after it gets to +3GB. When just using lein w/o the plugin, the file uberjar is around 98MB

Compiling dlp-inspect.core SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Compiling dlp-inspect.core

(defproject dlp-inspect "0.1.0-SNAPSHOT"
  :plugins [[lein-tools-deps "0.4.1"]]
  :middleware [lein-tools-deps.plugin/resolve-dependencies-with-deps-edn]
  :lein-tools-deps/config {:config-files [:install :user :project "./deps.edn"]
                           :clojure-executables ["/usr/local/bin/clojure"]}
  :clean-targets ^{:protect false} [...targets...]
  :profiles {:dev {:global-vars {*warn-on-reflection* false}}
             :uberjar {:uberjar-name "dlp-inspect.jar"
                       :aot :all
                       :main dlp-inspect.core}}
  :min-lein-version "2.8.0")
  :main dlp-inspect.core)

danoyoung avatar Dec 05 '18 19:12 danoyoung

Not sure if this is causing it but :project and "./deps.edn" both reference the same file. :project is a shorthand to include the deps.edn from your projects root directory. If you remove the "./deps.edn" bit do you still see the problem?

RickMoynihan avatar Dec 19 '18 01:12 RickMoynihan