开发者

How do I make sbt use the scala binaries from $SCALA_HOME directory?

sbt downloads new version of scala compiler and the scala library for every sbt project at this locatio开发者_C百科n: ./project/boot/scala-2.8.1/lib/scala-library.jar

./project/boot/scala-2.8.1/lib/scala-compiler.jar

How do I make it pick up the compiler and the library from the location pointed by $SCALA_HOME?

Also, I am surprised that it's not a common requirement. Do Scala developers prefer to use a separate copies of compiler and library for every project?

I found the same request which was unanswered: http://groups.google.com/group/simple-build-tool/browse_thread/thread/9e2c7bc34253ad0f?pli=1

Thanks in advance for your help.


Disclaimer, I don't use this myself but I was curious about whether this is possible.

Based on using a local scala instance, I defined the following project:

import sbt._
import java.io.File

class Test(info: ProjectInfo) extends DefaultProject(info) {
  override def localScala = 
    defineScala("2.8.1-local", new File(System.getenv("SCALA_HOME"))) :: Nil
}

Then in project/build/build.properties:

build.scala.versions=2.8.1-local

Then I can see that the console target works fine, which would suggest that it would work for compilation and running as well.


While I understand the concern, I would argue that using separate copies is a good thing

  • you can have several scala versions installed, and several projects using different scala versions. this is not uncommon (i currently have projects which use 2.8.0, other that use 2.8.1, others that use 2.9.0.RC1...) -- thus: would you edit $SCALA_HOME every time you switch to another project? not feasible
  • sbt stores them comfortably in the local ivy2 cache, so getting the versions is very fast
  • if you clone other peoples' project, you can just do sbt update and wooop scala is there, whether you had that particular version already or not
  • project/boot will typically not be checked into any repository, so your project folder is only bigger on your local harddisk. considering the amount of stuff you have on a developer computer, i would say the extra sizes for the library and compiler per project are peanuts with standard harddisks being several hundered GB

Did you try to ask the question again on the sbt googlegroup?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜