chengpohi chengpohi - 8 months ago 34
Scala Question

sbt 0.13.1 multi-project module not found when I change the sbt default scala library to scala 2.11.2

I use the sbt 0.13.1 create the two modules, and I create project/MyBuild.scala to compile this two modules.

import sbt._
import Keys._
object MyBuild extends Build {
lazy val task ="task"))
lazy val root =".")) aggregate(task) dependsOn task

When I change the scala library to 2.11.2 by set scalaHome. It will go to maven download the task.jar and failed, that's very strange. Is it a sbt bug?

There is the github test project address: test-sbt-0.13.1


I'd recommend you to move the sources of root project from root to subfolder (task2), and add them as aggregated. It will remove aggregating and depending on same project:

object MyBuild extends Build {
          lazy val task ="task"))
          lazy val task2 ="task2")) dependsOn task
          lazy val root =".")) aggregate(task, task2) 

This works for me, but it's strange that such non-standard project structure works fine with default scalaHome. Seems to be a problem in the way in which sbt resolves such dependency as external.

P.S. This answer doesn't cover the whole story. See @jjst's answer to clarify more.