1

我在解决两个不同包的依赖项发生冲突的问题时遇到了很多麻烦。我的 project.clj 的依赖项如下所示:

  :dependencies [[org.clojure/clojure "1.6.0"]
                 [itsy "0.1.1"]  
                 [amazonica "0.3.22" :exclusions [commons-logging org.apache.httpcomponents/httpclient com.fasterxml.jackson.core/jackson-core]]])

我的命名空间如下所示:

(ns crawler.core
  (:require [itsy.core :refer :all])
  (:require [itsy.extract :refer :all])
  (:use  [amazonica.core]
         [amazonica.aws.s3]))

当我尝试将命名空间加载到 lein 的 repl 中时(load crawler/core),我收到此错误:

CompilerException java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z, compiling:(amazonica/core.clj:1:1)

在线资源表明这是依赖项不匹配。我如何解决它?

4

1 回答 1

1

我将排除项放在itsy而不是amazonica上,它起作用了。还修复了 core.clj 中的 NS 表单。

项目.clj:

(defproject blabla "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"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [itsy "0.1.1" :exclusions [com.fasterxml.jackson.core/jackson-core]]  
                  [amazonica "0.3.22" :exclusions [commons-logging org.apache.httpcomponents/httpclient]]])

核心.clj:

(ns blabla.core
  (:require [itsy.core :refer :all]
            [itsy.extract :refer :all]
            [amazonica.core :refer :all]
            [amazonica.aws.s3 :refer :all]))

(defn foo
   "I don't do a whole lot."
  [x]
   (println x "Hello, World!"))

在一般情况下处理这些情况

lein deps:树

并添加排除项,直到仅保留最新版本。

于 2015-05-22T21:12:37.833 回答