As Scala 2.10.1 is coming out soon, I believe, I want to make sure that artifacts I publish now will automatically work with a scala-library.jar of that version. I use sbt 0.12.2 to publish, and with a setting of
scalaVersion := "2.10.0"
I get correctly attached the binary compatible version to my artifact, e.g.
<artifactId>mylibrary_2.10</artifactId>
...but the scala library dependency still says 2.10.0:
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.0</version> <!-- !!! -->
</dependency>
I suppose that is not correct, and it should use 2.10 or 2.10.+ here?
I also tried to add scalaBinaryVersion := "2.10"
but that doesn't seem to change anything.
Another idea I had was to use scalaVersion := "2.10.+"
. Sbt takes forever with Getting Scala 2.10.+ ...
, but it finally goes on fine and the pom
has this version now for scala-library.jar. So maybe this is the correct way?
sbt uses that same version of Scala to compile the build definitions that you write for your project because they use sbt APIs. This version of Scala is fixed for a specific sbt release and cannot be changed. For sbt 1.7. 1, this version is Scala 2.12.
Library dependencies can be added in two ways: unmanaged dependencies are jars dropped into the lib directory. managed dependencies are configured in the build definition and downloaded automatically from repositories.
All new SBT versions (after 0.7. x ) by default put the downloaded JARS into the . ivy2 directory in your home directory. If you are using Linux, this is usually /home/<username>/.
By default, sbt uses the standard Ivy home directory location ${user.
You should be good to go for 2.10.x, since it is meant to be binary compatible between minor versions (as documented in the release notes).
In general, you can generate artifacts for arbitrary versions of Scala using the crossScalaVersions
setting in sbt.
build.sbt
name := "so-14803362"
scalaVersion := "2.10.0"
crossScalaVersions := Seq("2.10.0", "2.10.1", "2.10.2")
With the above configuration, you can prepend a +
to sbt commands to run them for each Scala version:
> + publish
This will build and publish your project's artifacts with each Scala version listed in crossScalaVersions
.
See the sbt docs for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With