A.Sim
A.Sim

Reputation: 89

Scala: Intellij shows compile errors on Import statements

I'm trying to teach myself scala and I'm using IntelliJ IDEA 2016.1.3. The editor does not recognize import commands. Errors appear. I have downloaded libraries, but the problem persists. Am I doing something wrong?

Upvotes: 1

Views: 1033

Answers (1)

Carlos Galo Campos
Carlos Galo Campos

Reputation: 648

Try this,

1.) I created a scala project:

In your console:

$ activator new my-first-app play-scala

Please bear in mind that I just automate the creation of scala project which follow the conventional project structure. I am using the Play framework and activator command, fyi, but this is out of topic.

2.) I open the project folder in IntelliJ by

a. Go to File -> New -> Project from existing source

b. find the "my-first-app" folder

c. double click the "build.sbt"

d. a prompt appear and check the "Use auto-import" checkbox

e. make sure the project sdk is a JDK 1.8

enter image description here

f. Click OK.

g. Select the modules data as root. As is.

h. Go to Settings (Ctrl + Alt + s)

I. Under "Languages & Frameworks", go to "Play2"

j. In the Play2 section, check the "Use SBT watcher" and "Use Play 2 compiler for this project" enter image description here

h. Click "apply" then click "ok"

g. if still not work, refresh the project by going to SBT child window of intelliJ and click the refresh button.

enter image description here

Good luck! :D

Upvotes: 2

Related Questions