如何更改构建定义的 Scala 版本? [英] How to change Scala version for build definition?

查看:51
本文介绍了如何更改构建定义的 Scala 版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个简单的 SBT 项目,其中包括用于对 Scala 并行集合进行基准测试的 InputTasks.

I'm developing a simple SBT project that includes InputTasks for benchmarking Scala Parallel collections.

我已经定义了 InputKeys 并在遇到问题时开始编写任务.

I have defined the InputKeys and started writing the tasks when I encountered a problem.

由于我的基准测试需要 Scala 2.10.0-M5,我尝试在我的 build.sbt 中这样做:

Since my benchmarks require Scala 2.10.0-M5, I tried doing this in my build.sbt:

name := "scala-parallel-collection-benchmark"

version := "1.0.0"

organization := "com.google.summer"

scalaVersion := "2.10.0-M5"

但是,在编译时出现以下错误:

However, at compilation I get the following error:

[info] Loading project definition from C:\Users\Administrator\scala-parallel-collection-benchmark\project
[info] Compiling 1 Scala source to C:\Users\Administrator\scala-parallel-collection-benchmark\project\target\scala-2.9.1\sbt-0.11.3\classes...
[error] C:\Users\Administrator\scala-parallel-collection-benchmark\project\Build.scala:47: value tasksupport is not a member of scala.collection.parallel.mutable.ParArray[Int]
[error]                 collection.tasksupport = new ForkJoinTaskSupport(new ForkJoinPool(par))
[error]                            ^
[error] one error found
[error] {file:/C:/Users/Administrator/scala-parallel-collection-benchmark/project/}default-e0b2a2/compile:compile: Compilation failed

看来它仍然使用 Scala 2.9.1 来编译它.

It appears that it still uses Scala 2.9.1 to compile it.

如何设置 SBT 以便它使用 Scala 2.10.0-M5 编译我的代码?

How can I set up SBT so it compiles my code using Scala 2.10.0-M5?

推荐答案

scalaVersion 仅影响用于编译实际"源代码(通常位于 src/...).您的错误来自构建定义的一部分(在 project/ 下),它始终使用构建 sbt 的 Scala 版本进行编译.

scalaVersion only impacts the version of Scala used to compile the "actual" source code (usually located in src/...). Your error comes from a part of the build definition (under project/), which is always compiled with the Scala version that sbt was built with.

这篇关于如何更改构建定义的 Scala 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆