Hi Christian,

Friend (at least in this version) and clj-http depend on different
versions of org.apache.httpcomponents/httpclient. If the version friend
wants wins (friend first in dependencies), clj-http gets an earlier
version than it wants and fails because the earlier version does not
provide the same classes.

If you put [com.cemerick/friend "0.2.1" :exclusions
[org.apache.httpcomponents/httpclient]] then you will always get the
version of httpclient that clj-http specifies, regardless of the order
you specify the dependencies in. I don't know if that might cause a
runtime problem for friend, but I have used this setup without a problem
so far.

Regards,

Caspar

On Wed, Nov 05, 2014 at 12:20:42PM +0100, Christian Egli wrote:
> Hi all
> 
> I have a strange interaction between clj-http and com.cemerick/friend. I
> don't know if this is a problem in either of the two packages or maybe
> even Leiningen.
> 
> The problem is very easy to reproduce. Create a project with `lein new`,
> add dependencies to clj-http and com.cemerick/friend, start a repl and
> simpy require clj-http.client as follows:
> 
> $ lein new app friend-and-clj-http
> $ cd friend-and-clj-http
> $ # add clj-http and friend as a dependency to project.clj
> $ lein repl
> friend-and-clj-http.core=> (require '[clj-http.client :as client])
> 
> If the dependency to friend is before the dependency to clj-http you
> will get the following exception:
> 
> CompilerException java.lang.ClassNotFoundException: 
> org.apache.http.conn.ssl.SSLContexts, compiling:(clj_http/conn_mgr.clj:1:1)
> 
> However if you change the order of the dependencies everything works as
> expected.
> 
> $ # change the order of the dependencies
> $ lein repl
> friend-and-clj-http.core=> (require '[clj-http.client :as client])
> nil
> friend-and-clj-http.core=> Bye for now!
> 
> I put both versions of project.clj, the shell session and the output of
> `lein deps :tree` for both versions in public gists
> 
> - https://gist.github.com/egli/8e6086f4d35ff7c11f80 project.clj with
>   friend and clj-http as dependencies
> - https://gist.github.com/egli/ff26669047b9273741c6 project.clj with
>   clj-http and friend as dependencies 
> - https://gist.github.com/egli/076b4f450cc237e2ac4a shell session
> - https://gist.github.com/egli/b3e149aded64c7628f8e lein deps :tree with
>   friend before clj-http
> - https://gist.github.com/egli/4fa13bc791e52061f9e9 lein deps :tree with
>   clj-http before friend
> 
> Where do I report this problem?
> 
> Thanks
> Christian
> 
> -- 
> Christian Egli
> Swiss Library for the Blind, Visually Impaired and Print Disabled
> Grubenstrasse 12, CH-8045 Zürich, Switzerland
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to