override scalaVersion not working

600 views
Skip to first unread message

Sam Halliday

unread,
Mar 20, 2015, 11:03:38 AM3/20/15
to sbt...@googlegroups.com
Hi all,

We have a problem in ENSIME whereby sbt 0.13.7 is upgrading the project's scala version without our permission.

  https://github.com/ensime/ensime-server/issues/897

Basically, in order to provision a client's machine for running the ensime server, we generate a build.sbt like this

===================
import sbt._
import IO._
import java.io._

scalaVersion := "2.11.5"

resolvers += Resolver.sonatypeRepo("snapshots")

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

resolvers += "Akka Repo" at "http://repo.akka.io/repository"

libraryDependencies += "org.ensime" %% "ensime" % "0.9.10-SNAPSHOT"

val saveClasspathTask = TaskKey[Unit]("saveClasspath", "Save the classpath to a file")

saveClasspathTask := {
  val managed = (managedClasspath in Runtime).value.map(_.data.getAbsolutePath)
  val unmanaged = (unmanagedClasspath in Runtime).value.map(_.data.getAbsolutePath)
  val out = file("classpath_2.11.5_0.9.10-SNAPSHOT")
  write(out, (unmanaged ++ managed).mkString(File.pathSeparator))
}
================

and then we run `sbt saveClasspath`

In this example, the project's scalaVersion of 2.11.5 is being overridden by the scala version of its dependencies, which are on 2.11.6.

Using

  ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = false) }

(or `true`, I'm not really sure which side the override is coming from) makes no difference.

Best regards,
Sam

Sam Halliday

unread,
Mar 20, 2015, 11:06:09 AM3/20/15
to sbt...@googlegroups.com
Aha! Starting fresh with

  ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }

(that's TRUE) works.
Reply all
Reply to author
Forward
0 new messages