Ian Chu Te Ian Chu Te - 11 months ago 30
Java Question

How to change Leiningen dependency tree

I am using [korma "0.4.0"] in my project.

And this version of Korma, by default, uses c3p0-​

According to this SO post, I need c3p0-​​ to be able to use

on a
. I'm doing this because I need to be able to insert PostGre SQL arrays.

For the purpose of completeness, my code used to convert from a Clojure vector to an SQL Array object in Java is the following:

(-> db get-connection :datasource .getConnection)
(into-array String someVector)

Also, the error I am getting is:

Exception in thread "main" java.lang.AbstractMethodError:

Which is the same as the error mentioned in that same SO post I mentioned above.

How do I alter the dependency tree such that Korma is forced to use c3p0-​ instead of c3p0-​​?


in your project.clj, ask for the version which you need, and for good measure it's often helpful to exclude the dependency from the project which asks for the wrong version.

:dependencies [[com.mchange/c3p0 ""]
               [korma "0.4.2"
                :exclusions [c3p0]]]

The dependency resolver will respect top level dependencies over nested ones, and :exclusions will prevent the version asked for by a specific dep from being used.