3

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?

Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
  • Did you specify `scalaVersion` in the `some.git` project's own build file? I would think that sbt builds `depProject` entirely based on that project's own build file. Perhaps you didn't define `scalaVersion` there? – 0__ Feb 06 '14 at 09:31

1 Answers1

4

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.

Community
  • 1
  • 1
Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420