Exclude a library dependency from publishing a library

Hi, I wrote a library that has some dependencies used only during tests. When I publish the library I don’t want that this dependency is included since it is not needed for the code in src/main/scala but only in src/test/scala. Does anyone know how I can solve this?

libraryDependencies += "organization" %% "dep"  % "version",
1 Like

I believe you want sbt test scopes?

https://www.scala-sbt.org/1.x/docs/Testing.html

I.e add % Test to your test library imports?

1 Like