Stephen
Stephen

Reputation: 19944

sbt disagreeing with library about scala version

I'm trying to use scala-time with scala 2.10, and have found that it doesn't work with sbt correctly.

given something like

scalaVersion := "2.10.2"

libraryDependencies += "org.scalaj" %% "scalaj-time" % "0.7"

sbt will happily try to resolve http://repo1.maven.org/maven2/org/scalaj/scalaj-time_2.10/0.7/scalaj-time_2.10-0.7.pom.

Unfortunately, scalaj-time is publised with full scala versions as can be seen at http://central.maven.org/maven2/org/scalaj/.

It can be resolved with

 libraryDependencies += "org.scalaj" % "scalaj-time_2.10.2" % "0.7"

but I'm wanting to know if this is a change in sbt behaviour, a bug in scala-time's build or if there's a way to configure sbt to pass the 3-part version instead of 2-part.

Upvotes: 2

Views: 236

Answers (1)

Eugene Yokota
Eugene Yokota

Reputation: 95674

As Seth noted jorgeortiz85/scala-time likely was published using sbt that predates binary cross versioning convention that was introduced in sbt 0.12. You could do:

libraryDependencies += "org.scalaj" % "scalaj-time_2.10.2" % "0.7"

or

libraryDependencies += "org.scalaj" % "scalaj-time" % "0.7" cross CrossVersion.full

But then you'd be stuck with using 2.10.2 while Scala 2.10.4 is already out.

There's a similar Joda time wrapper named nscala-time/nscala-time that seems more actively maintained. Last updated 3 days ago and Scala 2.11.0 is supported already, so that could also be your option.

libraryDependencies += "com.github.nscala-time" %% "nscala-time" % "1.0.0"

Upvotes: 3

Related Questions