简体   繁体   English

如何更改Leiningen依赖树

[英]How to change Leiningen dependency tree

I am using [korma "0.4.0"] in my project. 我在项目中使用[korma“ 0.4.0”]。

And this version of Korma, by default, uses c3p0-​ 0.9.1.2 这个版本科尔马的,默认情况下,使用c3p0- 0.9.1.2

According to this SO post, I need c3p0-​ 0.9.5.1​ to be able to use createArrayOf on a NewProxyConnection . 根据 SO后,我需要c3p0- 0.9.5.1,以便能够使用createArrayOfNewProxyConnection I'm doing this because I need to be able to insert PostGre SQL arrays. 我这样做是因为我需要能够插入PostGre SQL数组。

For the purpose of completeness, my code used to convert from a Clojure vector to an SQL Array object in Java is the following: 为了完整起见,我用于在Java中将Clojure向量转换为SQL Array对象的代码如下:

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

Also, the error I am getting is: 另外,我得到的错误是:

Exception in thread "main" java.lang.AbstractMethodError: com.mchange.v2.c3p0.impl.NewProxyConnection.createArrayOf 线程“主”中的异常java.lang.AbstractMethodError:com.mchange.v2.c3p0.impl.NewProxyConnection.createArrayOf

Which is the same as the error mentioned in that same SO post I mentioned above. 这与我在上面提到的同一篇SO文章中提到的错误相同。

How do I alter the dependency tree such that Korma is forced to use c3p0-​ 0.9.5.1 instead of c3p0-​ 0.9.1.2 ​? 如何改变依赖关系树,使得科尔马被迫 c3p0- 0.9.5.1,而不是c3p0- 0.9.1.2使用?

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. project.clj ,索要所需的版本,并采取良好措施通常有助于从项目中排除要求错误版本的依赖项。

:dependencies [[com.mchange/c3p0 "0.9.5.1"]
               [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. 依赖解析器将尊重嵌套依赖的顶级依赖,而:exclusions将阻止使用特定dep要求的版本。

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

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