Back

add-libs (clj)

(source)

function

(add-libs lib-coords)
Given lib-coords, a map of lib to coord, will resolve all transitive deps for the libs together and add them to the repl classpath, unlike separate calls to add-lib.

Examples

clojure
(ns clojure.test-clojure.repl.deps
  (:use clojure.test)
  (:require [clojure.string :as str]
            [clojure.repl.deps :as deps]
            [clojure.main :as main]))

;(deftest test-no-add-libs-outside-repl
;  (try
;    (deps/add-lib 'org.clojure/data.json {:mvn/version "2.4.0"})
;    (is false "add-libs outside repl should throw")
;    (catch Throwable t (str/includes? (ex-message t) "add-libs")))
;
;  (with-dynamic-loader
;    (binding [*repl* true]
;      (is (some #{'org.clojure/data.json} (deps/add-lib 'org.clojure/data.json {:mvn/version "2.4.0"})))))
;  )
clojure/clojure
(ns clojure.test-clojure.repl.deps
  (:use clojure.test)
  (:require [clojure.string :as str]
            [clojure.repl.deps :as deps]
            [clojure.main :as main]))

;(deftest test-no-add-libs-outside-repl
;  (try
;    (deps/add-lib 'org.clojure/data.json {:mvn/version "2.4.0"})
;    (is false "add-libs outside repl should throw")
;    (catch Throwable t (str/includes? (ex-message t) "add-libs")))
;
;  (with-dynamic-loader
;    (binding [*repl* true]
;      (is (some #{'org.clojure/data.json} (deps/add-lib 'org.clojure/data.json {:mvn/version "2.4.0"})))))
;  )