Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Define scalaVersion setting for RootProject under git in SBT

Tags:

scala

sbt

In my project, I want to use some code from GitHub. The dependency is defined in Build.scala as follows:

object BuildSettings {
  val buildVersion      = "1.0-SNAPSHOT"
  val buildScalaVersion = "2.9.1"
  val buildName = "PageAnalyzer"

  val buildSettings = Defaults.defaultSettings ++ Seq (
    organization := buildOrganization,
    version      := buildVersion,
    scalaVersion := buildScalaVersion,
    name         := buildName
  )
}

object PageAnalyzerBuild extends Build {
  lazy val root = Project (
     "root",
     file ("."),
     settings = BuildSettings.buildSettings
  ) dependsOn (depProject)

  val depProject = RootProject(uri("git://github.com/me/some.git"))
}

For some reasons, I have to build the root project with Scala 2.9.x. In SBT 0.13, the depProject will be build with 2.10.x and the dependency cannot be build. root project tries to look for some some_2.9.1, but only some_2.10 is built.

Change scalaVersion to 2.10.x works fine. But I have to build the root project with 2.9.x. Is there any way to define scalaVersion for depProject cloned from git?

like image 754
Michael_Ong Avatar asked Jun 08 '26 12:06

Michael_Ong


1 Answers

You should be fine with scalaVersion in [project-id] := "2.9.0" where project-id is the project identifier from depProject or just use depProject for in. Run projects to know the names of available projects and pick the proper one for in.

It appears similar to Setting javac options for SBT dependencies.

like image 101
Jacek Laskowski Avatar answered Jun 10 '26 02:06

Jacek Laskowski