clojurejacksondependenciesleiningenamazonica

How do I fix this dependency issue in Clojure?


I'm having a lot of trouble fixing an issue where the dependencies for two different packages are colliding. My project.clj's dependencies look like this:

  :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]]])

My namespace looks like this:

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

When I try to load the namespace into lein's repl with (load crawler/core), I get this error:

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

Online sources suggest that this is a dependency mismatch. How do I fix it?


Solution

  • I put the exclusion on itsy rather than amazonica and it worked. Also fixed the NS form in core.clj.

    project.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]]])
    

    core.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!"))
    

    to deal with these situatuions in general run

    lein deps :tree

    and add exclusions until only the newest versions remain.