Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Scala imports working in IntelliJ IDEA with the Play framework?

I'm using the Scala plugin for IDEA and normally, it works (almost) perfectly.

However, it seems to have problem with the import statements for the Play framework: I often get the error "Cannot resolve symbol x". Now that doesn't stop the program from working, but it makes autocompletion completely useless.

Example: import org.scalatest.junit._

I already added /opt/play/framework/src and /opt/play/framework/play-1.2.2RC2.jar to classes and sources of my project. (using "Project Structure")

Any ideas on how to solve this? Or is this simply a bug?

(I am using Scala 2.9.0.1, IDEA 10.5 and Scala Plugin 0.4.1084)

like image 974
Mononofu Avatar asked Jun 18 '11 11:06

Mononofu


People also ask

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 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.


1 Answers

Try to add tmp/generated to your sources as well. Eclipse also has this issue, since the Play Framework generate the source files from the templates. See Errors in Eclipse for Scala project generated by Play Framework.

like image 53
Jonas Avatar answered Oct 20 '22 01:10

Jonas