scalasbtmill

Mill Build Tool, how to use `evicted`


I want to run evicted in my Mill-project.

With SBT it can be done in the sbt-console, using:

sbt>evicted

This returns a list of version conflicts warnings:

[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]  * com.typesafe:ssl-config-core_2.13:0.3.8 is selected over 0.4.0
[warn]      +- com.typesafe.play:play-ws-standalone_2.13:2.0.6    (depends on 0.3.8)
[warn]      +- com.typesafe.play:play_2.13:2.7.3 ()               (depends on 0.3.8)
[warn]      +- com.typesafe.akka:akka-stream_2.13:2.5.23 ()       (depends on 0.4.0)
....

How is this done with Mill?

I tried the mill-console, there is no command (mill resolve _) and also Google could not help.


Solution

  • I assume, you are looking for possible classpath issues/warnings, which are the result of different versions of the same dependencies pulled in by transitive dependencies.

    In mill, you can use the ivyDepsTree target to display a tree with all transitive ivy dependencies. This tree also includes details about version adjustments. Those lines will be printed in different colors. By default, orange for micro/patch version changes, red for minor version changes.

    Let's look at the following excerpt from a random Java project:

    $ mill __.ivyDepsTree
    ...
    [416/426] <redacted>.test.ivyDepsTree
    ├─ com.lihaoyi:mill-contrib-testng:0.5.1-14-ef3708
    │  ├─ org.scala-sbt:test-interface:1.0
    │  └─ org.testng:testng:6.11 -> 6.14.2 (possible incompatibility)
    │     ├─ com.beust:jcommander:1.72
    │     └─ org.apache-extras.beanshell:bsh:2.0b6
    ├─ org.testng:testng:6.14.2
    │  ├─ com.beust:jcommander:1.72
    │  └─ org.apache-extras.beanshell:bsh:2.0b6
    ├─ de.tototec:de.tobiasroeser.lambdatest:0.7.0
    ├─ org.slf4j:slf4j-api:1.7.25
    ├─ ch.qos.logback:logback-classic:1.2.3
    │  ├─ ch.qos.logback:logback-core:1.2.3
    │  └─ org.slf4j:slf4j-api:1.7.25
    ├─ org.aspectj:aspectjrt:1.8.13
    ├─ org.fedorahosted.tennera:jgettext:0.15
    │  ├─ antlr:antlr:2.7.7
    │  └─ org.slf4j:slf4j-api:1.7.5 -> 1.7.25
    ├─ org.antlr:com.springsource.antlr:2.7.7
    ...
    

    You can see some adaptions because of conflicting versions: org.slf4j:slf4j-api:1.7.5 -> 1.7.25 (micro version upgrade) and org.testng:testng:6.11 -> 6.14.2 (possible incompatibility) (minor version upgrade).

    Further, you could pipe the output to grep to filter the output, e.g. mill __.ivyDepsTree | grep "incompatibility".

    And this looks like a usable mill equivalent to sbt evicted.

    $ mill __.ivyDepsTree | grep "incompatibility"
    ...
    [416/426] <redacted>.test.ivyDepsTree 
    │  └─ org.testng:testng:6.11 -> 6.14.2 (possible incompatibility)
    │  ├─ org.hibernate:com.springsource.org.hibernate:3.2.6.ga -> 3.3.2.GA (possible incompatibility)
    │  ├─ org.jboss.javassist:com.springsource.javassist:3.3.0.ga -> 3.9.0.GA (possible incompatibility)
    │  └─ org.objenesis:objenesis:1.2 -> 2.6 (possible incompatibility)
    │  │     └─ org.objenesis:objenesis:1.2 -> 2.6 (possible incompatibility)
    │  │  │     └─ org.objenesis:objenesis:1.2 -> 2.6 (possible incompatibility)
    │  │  │  └─ org.objenesis:objenesis:1.2 -> 2.6 (possible incompatibility)
    │  │  └─ org.testng:testng:6.4 -> 6.14.2 (possible incompatibility)
    │  └─ org.testng:testng:6.4 -> 6.14.2 (possible incompatibility)
    │     │     └─ org.objenesis:objenesis:1.2 -> 2.6 (possible incompatibility)
    │        └─ org.objenesis:objenesis:1.2 -> 2.6 (possible incompatibility)