A Mill plugin for enforcing explicit dependencies. Inspired by sbt-explicit-dependencies.
It allows you to check that ivyDeps
and ivyCompileDeps
accurately reflect the direct dependencies of your source code.
Import the plugin in your build.sc
:
import $ivy.`io.github.kierendavies::mill-explicit-deps::0.2.0`
import io.github.kierendavies.mill.explicitdeps.ExplicitDepsModule
Use the mixin:
object foo extends ScalaModule with ExplicitDepsModule {
// ...
}
Then you can run the command mill -k __.checkExplicitDeps
.
It will fail if it finds any transitive dependencies which are either
- imported by a source file but not declared (in
ivyDeps
orcompileIvyDeps
), or - declared but not imported by any source files.
This plugin requires Mill 0.10.
It has been tested with Scala 2.13.10 and 3.2.1.