1

我正在使用 leiningen 同时开发 2 个项目(请参阅此处的Checkout Dependencies )。这是有效的,我已经达到了我想要部署这两个库的地步。假设它们是lib-parent,它使用lib-child

现在,我已将lib-child部署到 clojars ( lein deploy clojars)。但是,如果我现在将lib-child作为项目依赖项包含在lib-parent中,我将无法加载lib-child,因为它的依赖项之一(Datomic 和它使用com.google.common.cache.Cache)不会加载. 在 repl 上运行(require 'lib-child.plugin)会给我一个ClassNotFoundException : com.google.common.cache.Cache

这是i)一般的 leiningen 依赖问题还是ii) Datomic 没有获得所有依赖的问题?我正在使用[com.datomic/datomic-free "0.8.4143" :exclusions [org.slf4j/slf4j-nop org.slf4j/log4j-over-slf4j]].

user=> (require 'lib-child.plugin)
SLF4J: Failed to load class "org.slf4j.impl.StaticMDCBinder".
SLF4J: Defaulting to no-operation MDCAdapter implementation.
SLF4J: See http://www.slf4j.org/codes.html#no_static_mdc_binder for further details.

ClassNotFoundException com.google.common.cache.Cache  java.net.URLClassLoader$1.run (URLClassLoader.java:366)
user=> (pst *e)
ExceptionInInitializerError 
        java.lang.Class.forName0 (Class.java:-2)
        java.lang.Class.forName (Class.java:270)
        clojure.lang.RT.loadClassForName (RT.java:2098)
        clojure.lang.RT.load (RT.java:430)
        clojure.lang.RT.load (RT.java:411)
        clojure.core/load/fn--5018 (core.clj:5530)
        clojure.core/load (core.clj:5529)
        clojure.core/load-one (core.clj:5336)
        clojure.core/load-lib/fn--4967 (core.clj:5375)
        clojure.core/load-lib (core.clj:5374)
        clojure.core/apply (core.clj:619)
        clojure.core/load-libs (core.clj:5413)
Caused by:
ClassNotFoundException com.google.common.cache.Cache
        java.net.URLClassLoader$1.run (URLClassLoader.java:366)
        java.net.URLClassLoader$1.run (URLClassLoader.java:355)
        java.security.AccessController.doPrivileged (AccessController.java:-2)
        java.net.URLClassLoader.findClass (URLClassLoader.java:354)
        java.lang.ClassLoader.loadClass (ClassLoader.java:424)
        sun.misc.Launcher$AppClassLoader.loadClass (Launcher.java:308)
        java.lang.ClassLoader.loadClass (ClassLoader.java:357)
        java.lang.Class.forName0 (Class.java:-2)
        java.lang.Class.forName (Class.java:190)
        datomic.cache__init.__init0 (:-1)
        datomic.cache__init.<clinit> (:-1)
        java.lang.Class.forName0 (Class.java:-2)

谢谢

4

1 回答 1

0

Ok, fixed this. Removed all the :exclusions, in the Datomic declaration I used, in the lib-child project. Thanks to @hyPiRion on #leiningen @irc.freenode.org.

于 2013-10-11T15:29:30.887 回答