无法在 Intellij IDEA 13 中配置 Scala

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20728836/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 05:57:21  来源:igfitidea点击:

Can't configure Scala in Intellij IDEA 13

scalaintellij-idea

提问by VB_

I entered Scala courses on Coursera and used to write Scala projects in Eclipse Indigo. All worked well. But now I gonna to convert to my favorite IDE - Intellij IDEA.

我在 Coursera 上学习了 Scala 课程,并且曾经用Eclipse Indigo. 一切都很好。但现在我要转换为我最喜欢的 IDE - Intellij IDEA。

But I can't configure it for Scala usage.

但我无法为 Scala 使用配置它。

What I've already done:

我已经做了什么:

  1. Install Scala, set system SCALA_HOMEvariable
  2. Install SBT
  3. Install Scala plugin on Intellij IDEA
  1. 安装 Scala,设置系统SCALA_HOME变量
  2. 安装 SBT
  3. 在 Intellij IDEA 上安装 Scala 插件

What a problem:

有什么问题:

  1. When I import coursera assignments, Intellij doesn't see some classes like List, Arrayetc. For example, when I try to import it via Alt+Enterkey it propose me java.jang.reflect.Array, java.sql.Array, com.sun.xml....Array. So I can't import Scala Array with tailand headmethods.

  2. When I try: New Project-> Scala Modulethe are to problems:

    a) When I choose Set Scala Homeit complains that there are missing files

    b) When I choose Existent Librarythere is nothing to choose in Compiler/Standartfields.

  1. 当我导入 coursera 作业时,Intellij 看不到诸如ListArray等的某些类。例如,当我尝试通过Alt+Enter密钥导入它时,它会建议我java.jang.reflect.Array, java.sql.Array, com.sun.xml....Array。所以我不能用tailhead方法导入 Scala 数组。

  2. 当我尝试:New Project->Scala Module问题:

    a) 当我选择Set Scala Home它时,它抱怨缺少文件

    b) 当我选择时Existent Library,在Compiler/Standart字段中没有任何选择。

enter image description here

在此处输入图片说明

Question:

问题:

How to configure Intellij properly?

如何正确配置 Intellij?

采纳答案by David Weinberg

Is the directory you specified the right one? It should have bin, doc, etc. in it. If so, try entering the following by hand:

您指定的目录是否正确?它应该有 bin、doc 等。如果是这样,请尝试手动输入以下内容:

For compiler library, scala-compiler

对于编译器库, scala-compiler

For standard library, scala-library

对于标准库, scala-library

IDEA found these for me automatically, but perhaps something went wrong for you.

IDEA 会自动为我找到这些,但也许您出了点问题。

回答by lukas

It can be a problem with caches, try File -> Invalidate Caches

缓存可能有问题,请尝试 File -> Invalidate Caches

回答by Dirk bachmann

Make sure to manually add the scala-libraryas a dependency to your module. This is not done automatically when adding the Scala facet to an existing module.

确保将 手动添加scala-library为模块的依赖项。将 Scala 方面添加到现有模块时,这不会自动完成。