简体   繁体   中英

boot-clj: get rid of “version conflict detected”

boot-clj shows a lot of warnings about version conflicts on startup: They look like this:

Warning: version conflict detected: org.clojure/clojure version changes from 1.5.1 to 1.8.0
Warning: version conflict detected: clj-time version changes from 0.8.0 to 0.12.0
Warning: version conflict detected: riddley version changes from 0.1.7 to 0.1.12
Warning: version conflict detected: org.codehaus.plexus/plexus-utils version changes from 2.0.7 to 2.0.6
Warning: version conflict detected: org.clojure/tools.namespace version changes from 0.2.11 to 0.2.10
Warning: version conflict detected: com.fasterxml.jackson.core/jackson-core version changes from 2.1.1 to 2.3.2

I'm not quite understanding why sometimes the first version is lower than the other one and sometimes vice versa. It also looks that I cannot influence most of them. For example in my project I required clj-time in version 0.12.0 , so I guess the warning comes form a library, which itself requires clj-time in another version.

Is there way to fix them, or would I always use the -q flag in order to "suppress output from boot itself"? Would this maybe prevent other maybe more important output from being displayed?

Example:

File /tmp/stackoverflow/boot.build :

(set-env! :dependencies '[[clj-time "0.12.0"]
                          [joda-time "2.9.4"]])

In a terminal:

Borkdude@MBP /tmp/stackoverflow $ boot show -d
Warning: version conflict detected: joda-time version changes from 2.9.3 to 2.9.4
Warning: version conflict detected: joda-time version changes from 2.9.3 to 2.9.4
[clj-time "0.12.0"]
└── [org.clojure/clojure "1.8.0"]
[joda-time "2.9.4"]
Borkdude@MBP /tmp/stackoverflow $ boot show -p
Warning: version conflict detected: joda-time version changes from 2.9.3 to 2.9.4
Warning: version conflict detected: joda-time version changes from 2.9.3 to 2.9.4
[✔] joda-time
    ✔ 2.9.4
      joda-time
    ✘ 2.9.3
      clj-time

So, boot show -d will tell you the effective transitive dependency tree. boot show -p will give more detail about conflicts. Here it tells us that the dependency on joda-time pulls in joda-time 2.9.4 , but it conflicts with clj-time wanting to pull in joda-time 2.9.3 .

Suppose we didn't depend on joda-time directly but some other library foo , that depended on joda-time 2.9.4 . We could then get rid of this warning by using an exclusion on clj-time : [clj-time "0.12.0" :exclusions [joda-time]] to get 2.9.4 in our project without a warning.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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