简体   繁体   中英

Cross building in sbt with 2.10.0

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 .

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?

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM