Commit b59b6c2
Add BOM / dependency management support (com-lihaoyi#3924)
This PR adds support for user-specified BOMs and dependency management
in Mill.
BOM support allows users to pass the coordinates of an existing Maven
"Bill of Material" (BOM), such as [this
one](https://repo1.maven.org/maven2/io/quarkus/quarkus-bom/3.17.0/quarkus-bom-3.17.0.pom),
that contains versions of dependencies, meant to override those pulled
during dependency resolution. (They can also add exclusions to
dependencies.)
```scala
def bomDeps = Agg(
ivy"io.quarkus:quarkus-bom:3.17.0"
)
```
It also allows users to specify the coordinates of a parent POM, which
are taken into account just like a BOM:
```scala
def parentDep = ivy"org.apache.spark::spark-parent:3.5.3"
```
(in line with `PublishModule#pomParentProject` that's been added
recently)
It allows users to specify "dependency management", which act like the
dependencies listed in a BOM: versions in dependency management override
those pulled transitively during dependency resolution, and exclusions
in its dependencies are added to the same dependencies during dependency
resolution.
```scala
def dependencyManagement = Agg(
ivy"com.google.protobuf:protobuf-java:4.28.3",
ivy"org.java-websocket:Java-WebSocket:_" // placeholder version - this one only adds exclusions, no version override
.exclude(("org.slf4j", "slf4j-api"))
)
```
BOM and dependency management also allow for "placeholder" versions:
users can use `_` as version in their `ivyDeps`, and the version of that
dependency will be picked either in dependency management or in BOMs:
```scala
def bomDeps = Agg(
ivy"com.google.cloud:libraries-bom:26.50.0"
)
def ivyDeps = Agg(
ivy"com.google.protobuf:protobuf-java:_"
)
```
A tricky aspect of that PR is that details about BOMs and dependency
management have to be passed around via several paths:
- in the current module: BOMs and dependency management have to be taken
into account during dependency resolution of the module they're added to
- via `moduleDeps`: BOMs and dependency management of module
dependencies have to be applied to the dependencies of the module they
come from
- ~to transitive modules pulled via `moduleDeps`: BOMs and dependency
management of a module dependency have to be applied to the dependencies
of modules they pull transitively (if A depends on B and B depends on C,
from A, the BOMs and dep mgmt of B apply to C's dependencies too)~
(worked out-of-the-box with the previous point, via `transitiveIvyDeps`)
- via `ivy.xml`: when publishing to Ivy repositories (like during
`pubishLocal`), BOMs and dep mgmt details need to be written in the
`ivy.xml` file, so that they're taken into account when resolving that
module from the Ivy repo
- via POM files: when publishing to Maven repositories, BOMs and dep
mgmt details need to be written to POMs, so that they're taken into
account when resolving that module from the Maven repo
Fixes com-lihaoyi#19751 parent a73ca5f commit b59b6c2
File tree
16 files changed
+988
-42
lines changed- docs/modules/ROOT/pages
- fundamentals
- javalib
- kotlinlib
- scalalib
- example
- fundamentals/library-deps
- bom-1-external-bom
- bom-2-dependency-management
- main/util/src/mill/util
- scalalib
- src/mill/scalalib
- publish
- test/src/mill/scalalib
- publish
16 files changed
+988
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
99 | 127 | | |
100 | 128 | | |
101 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
19 | 24 | | |
20 | 25 | | |
21 | 26 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
34 | 48 | | |
35 | 49 | | |
36 | 50 | | |
| |||
51 | 65 | | |
52 | 66 | | |
53 | 67 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 68 | + | |
| 69 | + | |
74 | 70 | | |
75 | 71 | | |
76 | 72 | | |
| |||
262 | 258 | | |
263 | 259 | | |
264 | 260 | | |
| 261 | + | |
265 | 262 | | |
266 | 263 | | |
267 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
234 | 265 | | |
235 | 266 | | |
236 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
| |||
0 commit comments