Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a simple way to specify a global dependency exclude in SBT

How would you exclude a transitive dependency globally? My project depends on a lot of the Twitter libraries or on libraries that depend on the Twitter libraries. I don't want slf4j-jdk14 in my classpath, no matter what (I use logback as slf4j binding).

Currently I do this:

"com.twitter" %% "finagle-thriftmux" % "6.16.0" exclude("org.slf4j", "slf4j-jdk14") 

but every time someone adds another dependency that uses slf4j-jdk14 I might get it back into the classpath.

like image 738
reikje Avatar asked Sep 09 '14 15:09

reikje


People also ask

How do we specify library dependencies in sbt?

The libraryDependencies key Most of the time, you can simply list your dependencies in the setting libraryDependencies . It's also possible to write a Maven POM file or Ivy configuration file to externally configure your dependencies, and have sbt use those external configuration files.

What is Ivy in sbt?

Apache Ivy is a transitive package manager. It is a sub-project of the Apache Ant project, with which Ivy works to resolve project dependencies. An external XML file defines project dependencies and lists the resources necessary to build a project.

Which is the correct way to add dependencies in sbt file?

If you have JAR files (unmanaged dependencies) that you want to use in your project, simply copy them to the lib folder in the root directory of your SBT project, and SBT will find them automatically.

What is sbt dependency management?

These tools support automatic dependency management for your project. Like in almost every build system, SBT allows you to define library dependencies which are resolved automatically, so you don't have to download and package required libraries by yourself.


1 Answers

excludeDependencies += "org.slf4j" % "slf4j-jdk14"

like image 90
Jeffrey Aguilera Avatar answered Oct 12 '22 15:10

Jeffrey Aguilera