question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sbt exclusion rules don't handle Scala version specific dependencies

See original GitHub issue

steps

"net.liftweb" %% "lift-mapper" % "2.6-M4" % "compile" excludeAll(ExclusionRule("net.liftweb", "lift-json"))

problem

"net.liftweb" %% "lift-json" is actually not excluded (because you need cross versioned "lift-json_2.10").

expectation

ExclusionRule could smart up some how, or accept GroupArtifactID. The LHS of excludeAll is ModuleID so it should already know the crossVersion mode that its in.

original report

This came up as an issue recently, referenced in this Stack Overflow post from Channing Walton. Basically, the issue is that since exclusion rules are a pretty direct mapping (as I recall, anyway) onto Ivy, they don’t include relevant information that sbt knows, such as the Scala version being referenced. So, while you can include a dependency that’s Scala specific using the %% syntax, there’s no similar mapping available for exclusions. I’m not sure what form a solution to this might take, but at least extending it to include something along the lines of the ModuleID support for %% might make sense, as a start.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:20
  • Comments:27 (8 by maintainers)

github_iconTop GitHub Comments

6reactions
ryan-williamscommented, Dec 4, 2016

I’m using this workaround:

"com.holdenkarau" %% "spark-testing-base" % "1.6.3_0.4.7" exclude("org.scalatest", s"scalatest_${scalaBinaryVersion.value}")

If anyone has better/cleaner ideas I’d love to hear them!

4reactions
jvicancommented, Sep 25, 2017

@samudurand

val scalaKafkaClient = "net.cakesolutions" %% "scala-kafka-client-akka" % scalaKafkaClientVersion exclude ("com.typesafe.akka" %% "akka-actor")
Read more comments on GitHub >

github_iconTop Results From Across the Web

Excluding Dependencies with SBT | Baeldung on Scala
We exclude dependencies in SBT by using either the exclude or excludeAll keywords. It's important to understand which one to use: excludeAll is ......
Read more >
Is it possible to enforce different scala version for a specific ...
4 · No, there isn't a 2.13 release for this dependency. · A single Scala artifact can't contain classes compiled using different Scala...
Read more >
Better management of transitive dependencies and conflicts
You've run into trouble with version conflicts between dependencies and didn't know what to do or where to look for advice.
Read more >
sbt Reference Manual — Library Management
Manually managing dependencies involves copying any jars that you want to use to the lib directory. sbt will put these jars on the...
Read more >
So, what's wrong with SBT? - Haoyi's Programming Blog
Reading Protobuf definitions and generating Scala source code; Resolving maven coordinates and fetching third-party dependencies; Shading some ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found