21

I am using a JSON extension which relies on Mandubian's play-json 2.2-SNAPSHOT. Everything worked fine until now I have a project based on Scala-STM. sbt reports the following problem:

[error] Modules were resolved with conflicting cross-version suffixes 
        in {file:folder}project:
[error]    org.scala-stm:scala-stm _2.10, _2.10.0
java.lang.RuntimeException: Conflicting cross-version suffixes in: 
  org.scala-stm:scala-stm

Is there any chance to dig deeper into where these two "conflicting" versions come from? I am quite surprised that play-json should be depending on scala-stm?!

Furthermore, is there a way to convince sbt to shut the ... up. Because obviously 2.10 and 2.10.0 are equivalent versions.


EDIT: This seems to be an sbt 0.13 bug (and probably has nothing to do with Play-JSON), because if I revert to 0.12.4, the project successfully updates and builds. I am still interested in a work around for sbt 0.13.

0__
  • 66,707
  • 21
  • 171
  • 266
  • Rather than use Mandubian's play-json SNAPSHOT, why not just add this dependency - `"play % "play_2.10" % "2.1.0"` per my question - http://stackoverflow.com/questions/19436069/adding-play-json-library-to-sbt – Kevin Meredith Oct 18 '13 at 16:34
  • I am not sure it is a bug. I saw this problem too after upgrading, but then discovered that there were indeed two different versions of a library being used. It might be useful to turn it down to a warning I guess. – Channing Walton Nov 15 '13 at 11:33

3 Answers3

21

You can get around this by removing scala-stm with exclude

 "dependencyGroupId" %% "dependencyArtifactId" % "dependencyVersion" exclude("org.scala-stm", "scala-stm_2.10.0")

Do not forget to do sbt clean.

kompot
  • 798
  • 6
  • 8
  • 2
    Where do I add this in my `play` app? I presume `Build.scala`, but where inside of it? – Kevin Meredith Oct 18 '13 at 17:17
  • 1
    `Build.scala` for a newly created project (Play 2.1.x, as 2.2 does not use Build.scala anymore) contains variable `val appDependencies` that contains a `Seq` with dependencies. Right inside of it. – kompot Oct 19 '13 at 14:54
  • @kompot, Play 2.2 and 2.3 can be used with either `build.sbt` or `Build.scala`. – Paul Draper Aug 02 '14 at 16:25
  • 2
    What exactly does `exclude` do, it seems to be a catch all solution to when sbt is being a moron. Surely there has to be some consequences? – samthebest Dec 20 '14 at 21:25
  • exclude is described in http://www.scala-sbt.org/0.13/docs/Library-Management.html – matanster Jan 11 '16 at 21:12
2

Updated Play2 2.2 - downgrading to SBT from 0.13.0 -> 0.12.4 didn't work with me, but excluding using exclude("org.scala-stm", "scala-stm_2.10.0") on ALL app-specific dependencies I had worked fine -- anyway -- none of my dependencies shouldn't have anything to do with scala-stm.

Jukka Nikki
  • 366
  • 3
  • 7
2

If you'd like to see all libraries being pulled in to your SBT project, you can use the SBT dependency graph plugin.

Using this, you can see why scala-stm is being pulled in, and also check for other conflicting scala 2.10 and 2.11 dependencies.

Jon Onstott
  • 13,499
  • 16
  • 80
  • 133
  • Thanks, I have this plugin now globally installed and use it a lot. A good recommendation. – 0__ Aug 31 '14 at 13:37
  • that would be nice. but this plugin didnt work for me: "cannot resolve symbol virtual" in the line `net.virtualvoid.sbt.graph.Plugin.graphSettings ` – jsky Sep 17 '14 at 16:52
  • @jsky That line should be in /build.sbt instead of /project/build.sbt. Is that the case in your build? Or use the alternative approach mentioned here: https://github.com/jrudolph/sbt-dependency-graph#how-to-use – Jon Onstott Sep 17 '14 at 17:29