如何安装旧版本的scala [英] How to install an older version of scala

查看:61
本文介绍了如何安装旧版本的scala的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前已经安装了 scala 2.11.7 但为了修复 这个问题,我必须安装旧版本的scala(2.10.5).当我尝试使用 brew 安装时,我不断收到以下错误

I currently had installed scala 2.11.7 but in order to fix this issue, I have to install a older version of scala(2.10.5). When I try to install with brew, I keep getting the following error

Error: No available formula for 2.10.5 

我尝试下载 Scala 下载页面的二进制文件,但是当我加载 SDK 和 IntelliJ 中的所有库时,我收到此错误

I tried downloading the binaries for scala download page but when I load the SDK and all the libraries in IntelliJ, I just get this error

Error:scalac: No 'scala-library*.jar' in Scala compiler classpath in Scala SDK scala-sdk-2.10.5

那么在intellij中安装旧版本scala并设置相同的正确方法是什么

So what is the right way to install an older version of scala and setting the same in intellij

推荐答案

如果您使用 sbt(直接或通过 IntelliJ 构建的 Scala 工具)管理您的项目,该代码的 scala 版本在构建文件(build.sbtBuild.scala)中定义:

If you manage your project with sbt, the scala built tool, either directly or via IntelliJ, the version of scala for that code is defined in the build file (build.sbt or Build.scala):

scalaVersion  := "2.10.5"

选择这个路径,根本不需要在你的 Mac 上安装 scala.每个项目都有自己的版本——从您本地的 ivy 存储库中提取,因此不必每次都下载.

Choosing this path, there isn't even a need to install scala on your Mac at all. Each project will have its own version -- pulled from your local ivy repository, so it doesn't have to download it each time.

而不是输入 scala 来访问 REPL,而是输入 sbt console 来访问带有项目的 Scala 版本和依赖项的 REPL.

And rather than typing scala to get to the REPL, you type sbt console to get to the REPL with the project's scala version and dependencies loaded.

这篇关于如何安装旧版本的scala的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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