简体   繁体   English

Leiningen父母>子女>第三方图书馆依赖性错误

[英]Leiningen Parent > Child > 3rd-Party Library Dependency Errors

I'm using leiningen to develop 2 projects simultaneously (see Checkout Dependencies here ). 我正在使用leiningen同时开发2个项目(请参见此处的 Checkout Dependencies )。 That's working and I've gotten it to a point where I want to deploy both libraries. 那行得通,我已经到了要部署两个库的地步。 Let's say they are lib-parent , which uses lib-child . 假设它们是lib-parent ,它使用lib-child

Now, I've deployed lib-child to clojars ( lein deploy clojars ). 现在,我已经将lib-child部署到clojars( lein deploy clojars )。 But if I now include lib-child as a project dependency in lib-parent , I can't load lib-child because one of it's dependencies (Datomic and it's use of com.google.common.cache.Cache ) doesn't load. 但是,如果现在我将lib-child作为项目依赖项包含在lib-parent中 ,则无法加载lib-child,因为其中之一依赖项(Datomic,并且使用com.google.common.cache.Cache )不会加载。 Running (require 'lib-child.plugin) at the repl will give me a ClassNotFoundException : com.google.common.cache.Cache . 在repl上运行(require 'lib-child.plugin)会给我ClassNotFoundException:com.google.common.cache.Cache

Is this i) a general leiningen dependency issue or ii) an issue with Datomic not getting all of it's dependencies? 这是i)一个普遍的leiningen依赖问题,还是ii) Datomic没有完全依赖它的问题? I'm using [com.datomic/datomic-free "0.8.4143" :exclusions [org.slf4j/slf4j-nop org.slf4j/log4j-over-slf4j]] . 我正在使用[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)

Thanks 谢谢

Ok, fixed this. 好,解决这个问题。 Removed all the :exclusions , in the Datomic declaration I used, in the lib-child project. 删除了我在lib-child项目中使用的Datomic声明中的所有:exclusions Thanks to @hyPiRion on #leiningen @irc.freenode.org. 感谢#leiningen @ irc.freenode.org上的@hyPiRion。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM