Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala Compiler not found in Intellij IDEA 11 with Play 2.0 project

I created a project using the typical play new, and then I used play idea to generate the .iml file. When I imported the .iml file into Intellij IDEA, I could not figure out how to get the compiler library to recognize. Below are some screenshots:

enter image description here

enter image description here

Please help!

like image 229
Sean Freitag Avatar asked May 02 '12 04:05

Sean Freitag


People also ask

Why Scala class is not showing in IntelliJ?

On the Project pane on the left, right-click src and select New => Scala class. If you don't see Scala class, right-click on HelloWorld and click on Add Framework Support…, select Scala and proceed. If you see Error: library is not specified, you can either click download button, or select the library path manually.

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. Now you can successfully check out from VCS, create, or import Scala projects.

How do I select Scala version in IntelliJ?

Press Ctrl+Alt+S to open Settings/Preferences dialog. From the options on the left, select Build, Execution, Deployment | Compiler | Scala | Scala Compiler Server.

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)


3 Answers

This is a slight weirdness with the Scala settings in IntelliJ. Currently the only way to register a scala distribution is to create a new project.

Steps:

  1. File > New Project > Create project from scratch

  2. Leave all settings as default. Project name can be anything.

  3. On the "Please select the desired technologies" page, choose Scala. Some GUI elements will appear that allow you to tell IntelliJ how to find your scala compiler and library. Make sure to set the "Level" options to "global".

  4. Click Finish. Close the dummy project that you created, and go back to your real project. The Scala compiler that you registered should now be in the list on your project settings page.

like image 149
Chris B Avatar answered Oct 07 '22 15:10

Chris B


A variation that worked for me: drop the Scala facet and run 'Add framework support...' again.

  1. File / Project Structure / Facets

  2. Click Scala facet then minus to remove Scala facet from your module. Click OK.

  3. Right click your project/module, 'Add Framework Support...', choose Scala.

  4. Enter the path to your Scala compiler and library.

like image 39
Keeth Avatar answered Oct 07 '22 14:10

Keeth


I also ran into this problem, but the workaround as described by Chris B did not work for me, since in my case "Scala" was missing on the "Please select the desired technologies" page.

In my case the problem appeared to be an incompatible Scala plugin. After I reinstalled the Scala plugin it worked fine.

like image 22
rintcius Avatar answered Oct 07 '22 14:10

rintcius