Scala doesn't compile Intellij

Hello,
I am beginner with Scala I would like work on Intellij.

Screen underneath:

How to fix it?:slight_smile:

Hi. Your project already contains a build.sbt file, but Intellij seems to not have picked it up (AFAIK, the output path setting is only required for Intellij projects without a build tool like sbt).

In my experience what works best is to close the project in Intellij, then open the build.sbt file instead of the project. Use the button at the top, not the project’s name in the list below:

After selecting the build.sbt file in your project, it should ask you if you want to open it as a file or as a project:


Choose “Open as project”, this should then use sbt to compile the project, which will set all paths correctly.
If that dialog doesn’t pop up, try deleting the .idea folder and any .iml files in the project folder and try again.

Also, you have a src/main folder (and probably a scala folder in that). sbt probably created these, as it expects any Scala files to be below src/main/scala by default, so you should move your created packages (cwiczenie1 and cwickzenie2) into that folder. It is possible to change that in build.sbt, but I’d start with the default layout first.

1 Like