[英]How do I change intellij idea to compile with scala 2.11?
I am using Intellij Idea 13.1.4. 我正在使用Intellij Idea 13.1.4。 I have a scala sbt project. 我有一个scala sbt项目。 It is currently being compiled with Scala 2.10. 它目前正在使用Scala 2.10进行编译。 I would like to change this to Scala 2.11. 我想将此更改为Scala 2.11。 In my build.sbt, I have: 在我的build.sbt中,我有:
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % "2.11.0",
...
)
When I build my project, it still builds as a Scala 2.10 project. 当我构建我的项目时,它仍然构建为Scala 2.10项目。
Also, under my Project Settings->Modules->Scala->Facet 'Scala'->Compiler library
, Intellij still shows scala-compiler-bundle:2.10.2
. 此外,在我的Project Settings->Modules->Scala->Facet 'Scala'->Compiler library
,Intellij仍显示scala-compiler-bundle:2.10.2
。 There is no option for a 2.11.x
bundle. 2.11.x
捆绑包没有选项。 How would I get an option for Scala 2.11.x? 我如何获得Scala 2.11.x的选项?
Thanks! 谢谢!
In IntelliJ 2016.x you upgrade Scala by 在IntelliJ 2016.x中,您可以升级Scala
Ensure Scala Plugin up to date. 确保Scala插件是最新的。
Then by going to: 然后去:
File | 档案| Other Settings | 其他设置| Default Project Structure | 默认项目结构| Global Libraries 全球图书馆
Click the +
button at the top left hand side of the Window 单击窗口左上角的+
按钮
Select Scala SDK
选择Scala SDK
Choose the version you want to install. 选择要安装的版本。
I have had the same issue as you. 我和你有同样的问题。 I added scala version 2.11 in my build.sbt
. 我在build.sbt
添加了scala版本2.11。 After that, I removed the default scala SDK by 之后,我删除了默认的scala SDK
File > Other Settings > Default Project Structures > Platform Settings > Global Libraries
转到File > Other Settings > Default Project Structures > Platform Settings > Global Libraries
scala-sdk-2.10.6
删除scala-sdk-2.10.6
Hence, IntelliJ will pick up my project scala SDK (after I do sbt assembly
) 因此,IntelliJ将拿起我的项目scala SDK(在我做sbt assembly
)
In .iml file, there is entry for scala sdk library as shown below: 在.iml文件中,scala sdk库有条目,如下所示:
<orderEntry type="library" name="scala-sdk-2.10.6" level="application" />
<orderEntry type="library" name="scala-sdk-2.11.8" level="application" />
comment or remove the scala sdk version entry that you dont want. 评论或删除您不想要的scala sdk版本条目。
You'll have to add first a new scala-compiler in File > Other Settings > Default Project Structure… 您必须首先在文件>其他设置>默认项目结构中添加新的scala编译器...
In scala-compiler include: 在scala-compiler中包括:
<SCALA_HOME>/lib/scala-compiler.jar
<SCALA_HOME>/lib/scala-library.jar
<SCALA_HOME>/lib/scala-reflect.jar
Replace with your scala installation directory. 替换为scala安装目录。
Go to File > Project Settings… and select the newly created compiler-library in "Compiler library". 转到文件>项目设置...并在“编译器库”中选择新创建的编译器库。 You may have to select Scala 2.11 in Language Level as well. 您可能还必须在语言级别中选择Scala 2.11。
将其添加到build.sbt文件中
scalaVersion='2.11.11'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.