如何让 sbt 使用 $SCALA_HOME 目录中的 scala 二进制文件?

发布于 2024-10-31 02:17:46 字数 518 浏览 2 评论 0原文

sbt 在此位置为每个 sbt 项目下载新版本的 scala 编译器和 scala 库: ./project/boot/scala-2.8.1/lib/scala-library.jar
./project/boot/scala-2.8.1/lib/scala-compiler.jar

如何让它从 $SCALA_HOME 指向的位置获取编译器和库?

另外,令我惊讶的是,这不是一个常见的要求。 Scala 开发人员是否更喜欢为每个项目使用单独的编译器和库副本?

我发现同样的请求没有得到答复: http://groups.google.com/group /simple-build-tool/browse_thread/thread/9e2c7bc34253ad0f?pli=1

预先感谢您的帮助。

sbt downloads new version of scala compiler and the scala library for every sbt project at this location:
./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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

物价感观 2024-11-07 02:17:46

免责声明,我自己不使用这个,但我很好奇这是否可能。

基于使用本地 scala 实例,我定义了以下项目:

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
}

然后在 project/build/build.properties 中:

build.scala.versions=2.8.1-local

然后我可以看到 console 目标工作正常,这表明它也适用于编译和运行。

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.

私野 2024-11-07 02:17:46

虽然我理解这种担忧,但我认为使用单独的副本是一件好事,

  • 你可以安装多个 scala 版本,并且使用多个项目
    不同的scala版本。这并不罕见(我目前有项目
    其中使用 2.8.0,其他使用 2.8.1,其他使用 2.9.0.RC1...) - 因此:
    每次切换到另一个项目时都会编辑 $SCALA_HOME 吗?不可行
  • sbt 将它们舒适地存储在本地 ivy2 缓存中,因此获取版本是
    如果你克隆其他人的项目,速度非常快
  • ,你只需执行 sbt update 即可,wooop scala 是
    在那里,无论您是否已经拥有该特定版本,
  • project/boot 通常都不会被签入任何存储库,因此您的项目文件夹
    仅在您的本地硬盘上更大。考虑到你身上的东西的数量
    对于开发人员计算机,我会说每个库和编译器的额外大小
    项目是微不足道的,标准硬盘有几百 GB

您是否尝试在 sbt googlegroup 上再次询问这个问题?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文