Intellij Idea setup for Scala, clarification needed

前端 未结 3 1229
無奈伤痛
無奈伤痛 2020-12-14 03:28

Using IntelliJIdea 12, i downloaded the Scala plugin and created a HelloWorld application.

The following import seems odd. Why does IDEA not recognize this to be a S

相关标签:
3条回答
  • 2020-12-14 03:45

    You need to add Scala as a framework for your project.

    To do this, right click on the top level directory in your project, choose "Add Framework Support..." and select Scala. Then Scala will be added as a "Facet" of your project.

    Here is a good page with more info:

    • IDEA Scala Project Configuration Explained
    0 讨论(0)
  • 2020-12-14 03:59

    I got around this by downloading the Scala library from scala-lang.org, unzipping it and then pointing the project to it. It worked fine after that. But of course, I'm an eclipse guy so perhaps someone else might be able to give you a better automated (?) solution. Here's what my project looks like in Module Settings -> Libraries:

    enter image description here

    0 讨论(0)
  • 2020-12-14 04:01

    When creating a new Scala project from the wizard IDEA can download and configure everything for you:

    New Scala Project

    Settings can be changed later in the Scala Facet:

    facet

    and in Compiler:

    compiler

    Libraries configuration:

    compiler

    scala

    Code and imports completion is available from the Scala library:

    completion

    0 讨论(0)
提交回复
热议问题