Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij Idea setup for Scala, clarification needed

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 Scala Application? Is my setup incomplete?

enter image description here

I checked to see where does my compiler points to and got this. Don't really see a way to navigate IDEA to my scala installation.

Please advise.

enter image description here

like image 816
James Raitsev Avatar asked Dec 05 '12 04:12

James Raitsev


People also ask

How do I enable Scala in IntelliJ?

To install Scala plugin, press Ctrl+Alt+S , open the Plugins page, browse repositories to locate the Scala plugin, click Install and restart IntelliJ IDEA.

How do I add Scala framework support in IntelliJ?

To add Scala support to existing module:Right-click the module in Project View, choose “Add Framework Support…” Check “Scala” in technologies list (unavailable if module has Scala facet attached) Provide a path to Scala installation (if not detected)

How do I find the Scala version in IntelliJ?

BTW, if you want to find out in IntelliJ, simply click on some class part of the Scala library, it takes you to the definition. Look at the bread crumb below the menu bar. It shows you which file it found it, the file name includes the version number.


3 Answers

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

like image 177
CrazyCoder Avatar answered Oct 05 '22 03:10

CrazyCoder


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
like image 38
sourcedelica Avatar answered Oct 05 '22 02:10

sourcedelica


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

like image 34
Plasty Grove Avatar answered Oct 05 '22 03:10

Plasty Grove