Skip to content

Commit 9cc9c00

Browse files
committed
🏗️ build: use Junit BOM
1 parent 22935b9 commit 9cc9c00

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

build.sbt

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import com.here.bom.Bom
12
import ReleaseTransformations._
23
import xerial.sbt.Sonatype.sonatypeSettings
34
import xerial.sbt.Sonatype.sonatypeCentralHost
@@ -42,9 +43,11 @@ scalaVersion := scala213
4243
val cucumberVersion = "7.28.0"
4344
val jacksonVersion = "2.20.0"
4445
val mockitoScalaVersion = "1.17.45"
45-
val junitVersion = "4.13.2"
46-
val junitJupiterVersion = "5.13.4"
47-
val junitPlatformVersion = "1.13.4"
46+
val junit4Version = "4.13.2"
47+
48+
// BOMs
49+
50+
lazy val junitBom = Bom("org.junit" % "junit-bom" % "5.13.4")
4851

4952
// Projects and settings
5053

@@ -56,7 +59,11 @@ lazy val commonSettings = Seq(
5659
case Some((3, _)) => ScalacOptions.scalacOptions3
5760
case _ => Seq()
5861
}
59-
}
62+
},
63+
// Load BOMs
64+
junitBom,
65+
// Add all dependencies of the BOM in dependencyOverrides
66+
dependencyOverrides ++= junitBom.key.value.bomDependencies
6067
)
6168

6269
lazy val junit4SbtSupport = Seq(
@@ -90,7 +97,7 @@ lazy val cucumberScala = (projectMatrix in file("cucumber-scala"))
9097
"io.cucumber" % "cucumber-core" % cucumberVersion,
9198
// Users have to provide it (for JacksonDefaultDataTableTransformer)
9299
"com.fasterxml.jackson.module" %% "jackson-module-scala" % jacksonVersion % Provided,
93-
"org.junit.jupiter" % "junit-jupiter" % junitJupiterVersion % Test,
100+
"org.junit.jupiter" % "junit-jupiter" % junitBom.key.value % Test,
94101
("org.mockito" %% "mockito-scala" % mockitoScalaVersion % Test)
95102
.cross(CrossVersion.for3Use2_13)
96103
),
@@ -141,8 +148,7 @@ lazy val integrationTestsCommon =
141148
.settings(
142149
name := "integration-tests-common",
143150
libraryDependencies ++= Seq(
144-
"org.junit.jupiter" % "junit-jupiter" % junitJupiterVersion % Test,
145-
"org.junit.platform" % "junit-platform-suite" % junitPlatformVersion % Test,
151+
"org.junit.platform" % "junit-platform-suite" % junitBom.key.value % Test,
146152
"io.cucumber" % "cucumber-junit-platform-engine" % cucumberVersion % Test
147153
),
148154
publishArtifact := false
@@ -157,8 +163,7 @@ lazy val integrationTestsJackson =
157163
.settings(
158164
name := "integration-tests-jackson",
159165
libraryDependencies ++= Seq(
160-
"org.junit.jupiter" % "junit-jupiter" % junitJupiterVersion % Test,
161-
"org.junit.platform" % "junit-platform-suite" % junitPlatformVersion % Test,
166+
"org.junit.platform" % "junit-platform-suite" % junitBom.key.value % Test,
162167
"io.cucumber" % "cucumber-junit-platform-engine" % cucumberVersion % Test,
163168
"com.fasterxml.jackson.module" %% "jackson-module-scala" % jacksonVersion % Test
164169
),
@@ -174,8 +179,7 @@ lazy val integrationTestsPicoContainer =
174179
.settings(
175180
name := "integration-tests-picocontainer",
176181
libraryDependencies ++= Seq(
177-
"org.junit.jupiter" % "junit-jupiter" % junitJupiterVersion % Test,
178-
"org.junit.platform" % "junit-platform-suite" % junitPlatformVersion % Test,
182+
"org.junit.platform" % "junit-platform-suite" % junitBom.key.value % Test,
179183
"io.cucumber" % "cucumber-junit-platform-engine" % cucumberVersion % Test,
180184
"io.cucumber" % "cucumber-picocontainer" % cucumberVersion % Test
181185
),
@@ -192,7 +196,7 @@ lazy val examplesJunit4 = (projectMatrix in file("examples/examples-junit4"))
192196
name := "scala-examples",
193197
libraryDependencies ++= Seq(
194198
"io.cucumber" % "cucumber-junit" % cucumberVersion % Test,
195-
"junit" % "junit" % junitVersion % Test
199+
"junit" % "junit" % junit4Version % Test
196200
),
197201
publishArtifact := false
198202
)
@@ -206,8 +210,7 @@ lazy val examplesJunit5 = (projectMatrix in file("examples/examples-junit5"))
206210
name := "scala-examples",
207211
libraryDependencies ++= Seq(
208212
"io.cucumber" % "cucumber-junit-platform-engine" % cucumberVersion % Test,
209-
"org.junit.jupiter" % "junit-jupiter" % junitJupiterVersion % Test,
210-
"org.junit.platform" % "junit-platform-suite" % junitPlatformVersion % Test
213+
"org.junit.platform" % "junit-platform-suite" % junitBom.key.value % Test
211214
),
212215
publishArtifact := false
213216
)

project/plugins.sbt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")
1616

1717
// Junit 5
1818
addSbtPlugin("com.github.sbt.junit" % "sbt-jupiter-interface" % "0.15.1")
19+
20+
// Usage of BOMs
21+
addSbtPlugin("com.here.platform" % "sbt-bom" % "1.0.27")

0 commit comments

Comments
 (0)