Recommand · December 8, 2021 0

How to exclude sub-dependencies marked as Test with sbt?

In our sbt project we include dependencies like

"com.github.swagger-akka-http" %% "swagger-scala-module" % "2.5.2"

Some of the dependencies that the swagger-akka-http library defines are marked as Test, like

"com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test

All sub-dependencies marked as Test (like akka-testkit) should be excluded from our project, especially during assembly.

We can manually exclude every dependency using ExcludeAll with the organization and package name. However, we’d much rather exclude all sub-dependencies marked as Test for all our dependencies.

Is this possible somehow?