diff --git a/leiningen-core/src/leiningen/core/classpath.clj b/leiningen-core/src/leiningen/core/classpath.clj index 68ccc9bf..bc9b63a3 100644 --- a/leiningen-core/src/leiningen/core/classpath.clj +++ b/leiningen-core/src/leiningen/core/classpath.clj @@ -6,7 +6,8 @@ [clojure.string :as str] [leiningen.core.user :as user]) (:import (java.util.jar JarFile) - (java.net URL))) + (java.net URL) + (org.sonatype.aether.resolution DependencyResolutionException))) ;; Basically just for re-throwing a more comprehensible error. (defn- read-dependency-project [root dep] @@ -117,6 +118,12 @@ :mirrors mirrors :transfer-listener :stdout :proxy (get-proxy-settings)) + (catch DependencyResolutionException e + (binding [*out* *err*] + (println "Check :dependencies and :repositories for typos.") + (println "It's possible the specified jar is not in any repository.") + (println "If so, see \"Free-floating Jars\" under http://j.mp/repeatability")) + (throw (ex-info "Could not resolve dependencies" {:exit-code 1}))) (catch Exception e (if (and (instance? java.net.UnknownHostException (root-cause e)) (not offline?)) diff --git a/leiningen-core/src/leiningen/core/eval.clj b/leiningen-core/src/leiningen/core/eval.clj index 337b7887..cbbe9509 100644 --- a/leiningen-core/src/leiningen/core/eval.clj +++ b/leiningen-core/src/leiningen/core/eval.clj @@ -7,8 +7,7 @@ [leiningen.core.user :as user] [leiningen.core.project :as project] [leiningen.core.main :as main] - [leiningen.core.classpath :as classpath]) - (:import (org.sonatype.aether.resolution DependencyResolutionException))) + [leiningen.core.classpath :as classpath])) ;; # OS detection @@ -55,13 +54,7 @@ (defn prep [project] ;; This must exist before the project is launched. (.mkdirs (io/file (:compile-path project "/tmp"))) - (try (classpath/get-classpath project) - (catch DependencyResolutionException e - (main/info (.getMessage e)) - (main/info "Check :dependencies and :repositories for typos.") - (main/info "It's possible the specified jar is not in any repository.") - (main/info "If so, see \"Free-floating Jars\" under http://j.mp/repeatability") - (main/abort))) + (classpath/resolve-dependencies :dependencies project) (run-prep-tasks project) (.mkdirs (io/file (:compile-path project "/tmp"))) (when-let [prepped (:prepped (meta project))] diff --git a/leiningen-core/src/leiningen/core/main.clj b/leiningen-core/src/leiningen/core/main.clj index 6a6a1016..6ab79a56 100644 --- a/leiningen-core/src/leiningen/core/main.clj +++ b/leiningen-core/src/leiningen/core/main.clj @@ -217,6 +217,8 @@ or by executing \"lein upgrade\". ") (project/load-plugins default-project))) (try (warn-chaining task-name args) (apply-task task-name project args) + (catch clojure.lang.ExceptionInfo e + (exit (:exit-code (ex-data e) 1))) (catch Exception e (when-let [[_ code] (and (.getMessage e) (re-find #"Process exited with (\d+)" diff --git a/src/leiningen/trampoline.clj b/src/leiningen/trampoline.clj index 620ff166..71755b7d 100644 --- a/src/leiningen/trampoline.clj +++ b/src/leiningen/trampoline.clj @@ -40,7 +40,7 @@ than as a subprocess of Leiningen's project. Use this to save memory or to work around stdin issues." [project task-name & args] - ;; TODO: allow trampoline calls to chain with do + ;; TODO: allow trampoline calls to chain with do (does this already work?) (let [forms (atom [])] (when (:eval-in-leiningen project) (main/info "Warning: trampoline has no effect with :eval-in-leiningen.")) diff --git a/todo.org b/todo.org index be99a9ca..02494aaf 100644 --- a/todo.org +++ b/todo.org @@ -7,8 +7,11 @@ See also https://github.com/technomancy/leiningen/issues - [ ] Recover from interrupted self-install (#719) - [ ] Honor :local-repo in trampoline (#695) - [ ] Improve speed of trampoline restarts (#573) + - [ ] Calculate trampoline classpath based on project at time of eval-in-project. + - [ ] Reduce verbosity of Aether. (#610) - [ ] Isolate target dir per profile (#468) - [ ] Honor mirror for search indices (#281) + - [ ] Allow search queries on any field. (#243) - [ ] Drop clojars snapshots from default repos (#241) ** 2.0.0-preview8 - [X] Allow trampoline to work with chaining in do task (#665)