score:0

I have a multi-module Gradle project. Most of them are Java and one is Scala. The project built successfully on the terminal, but IntelliJ complained missing SDK on the Scala code tabs.

The root cause might be that I opened this project before installing the Scala plugin. I restarted the IDE and clicked Reload All Gradle Projects in the Gradle tab on the right-hand side. Then the problem was solved.

score:2

For MAC users:

With the latest IntelliJ IDEA 2020.2.2 (Community Edition) (Build #IC-202.7319.50, built on September 15, 2020), 2 things have to be done:

  1. Go to IntelliJ IDEA -> Preferences -> Plugins -> Scala
  2. Now, install scala using home-brew : brew install scala

Once these both are done, open a scala project and File -> Project Structure -> Global Libraries -> click on '+' -> Scala SDK -> select or download the sdk -> Add.

This worked for me.

score:3

Download and install Scala from Official web site. Create a new Scala SDK and point it to the scala installation path.(eg: C:\Program Files (x86)\scala ) Choose this SDK while creating the new project. Otherwise you can create the Scala SDK during the new project wizard as well.

score:4

So, what that solved that for me was:

  1. close intelliJ
  2. open the project folder and delete intelliJs folder that was added on import. simply rm -rf .idea (mac/linux etc.)
  3. import the project again...

score:5

I spent some 2 hours trying to figure a similar issue. My files were complaining that there was no Scala SDK setup and to add it as a module dependency. However the scala dependency was not compiled so it was giving errors.

The trick was to choose SBT as the model when importing the project and let IntelliJ add your dependencies.

score:7

right click on the project and click add framwork support and select the Scala library : add framwork support / Scala

score:19

i had this same problem to solve it right-click on your project and click "Add framework support" then click add library and navigate to the lib folder in your Scala directory in your pc

score:21

I'm assuming you mean Project Structure -> Modules -> Dependencies

You can just click on the Add... button in that view. A "Module" here is simply a Jar file or directory containing classes.

You wouldn't normally do this though. A better approach is:

  • Create the project using Maven and the maven-scala-plugin, then import it as a Maven project into IntelliJ

or

  • Create the project using SBT, and use the SBT IDEA plugin to generate the IntelliJ project

Either way, the correct dependencies will then be created for you.

UPDATE

Based on your comment, it looks as though your problem is that IntelliJ doesn't know where to find the Java SDK (this is nothing to do with modules, it just happens to appear in that window)

Under Project Structure -> Project, you'll see an option for "Project SDK" with the value "" highlighted in red.

Click the new button beside this, select "jsdk", and point it to the directory where you installed the Java SDK.

Then all should be good.


Related Query

More Query from same tag