4
votes

I am cross building a scala project with sbt 12.1.

crossScalaVersions := Seq("2.9.2", "2.10.0")

However, it can't find the dependencies because they are named _2.10 not _2.10.0. It seems like it's regular to name your library 2.10 instead of 2.10.0 with the exception of scala-language and scala-compiler. For example, scalaz is not found at http://repo1.maven.org/maven2/org/scalaz/scalaz-core_2.10.0/6.0.4/scalaz-core_2.10.0-6.0.4.pom but at http://repo1.maven.org/maven2/org/scalaz/scalaz-core_2.10/6.0.4/scalaz-core_2.10-6.0.4.pom.

Is there an easy way to handle this without writing custom rules for all of my dependencies?

The actual build.sbt is available online.

2
I also noticed that some libraries are suffixed 2.10 and some 2.10.0, and find that rather unfortunate. I might just not have noticed it back then, but I don't remember running into a similar problem with Scala 2.8 and 2.9.Malte Schwerhoff
So in other words--special case them all? ;-(schmmd

2 Answers

2
votes

Since 2.10.x releases are binary compatible between each other, libraries need to be built only with one version of scala library - and they can (and must) drop the .0 part (if you publish with sbt, it is done automatically). When the maintainer of a library releases a library with _2.10.0 tag, it's a mistake and you should consider filing a bug.

By the way, I looked on your build.sbt - running +compile on it works for me (sbt 0.12.1). Do you experience some errors?

0
votes

To get the Scala version incorporated into the artifact name in the Scala way, you specify the dependency with the %% operator:

libraryDependencies += "io.backchat.jerkson" %% "jerkson" % "0.7.0"

When the exact match is not available, you can specify the Scala version explicitly (but remember compatibility only exists across patch releases of a given major/minor release of Scala):

libraryDependencies += "io.backchat.jerkson" % "jerkson_2.9.2" % "0.7.0"