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

前端 未结 3 1940
不知归路
不知归路 2021-02-05 02:54

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

相关标签:
3条回答
  • 2021-02-05 03:26
    libraryDependencies := libraryDependencies.value.map(_.exclude("groupid", "artifactname"))
    
    0 讨论(0)
  • 2021-02-05 03:28

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

    0 讨论(0)
  • 2021-02-05 03:45

    Since sbt 0.13.8

    In sbt 0.13.8 there is possibility to exclude dependencies globally. Here is a compact example:

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

    However, at the moment of writing this feature was marked as experimental so it's wise to be aware of older solution.

    Before sbt 0.13.8

    For a group of dependencies you can do it as follows:

    libraryDependencies ++= Seq(
      "com.twitter" %% "finagle-thriftmux" % "6.16.0",
      "com.twitter" % "lib" % "2.0",
      "com.domain" % "some-other-lib" % "1.0"
    ).map(_.exclude("org.slf4j", "slf4j-jdk14"))
    
    0 讨论(0)
提交回复
热议问题