SBT compilation for play framework 2.x disabled by default

Intellij IdeaPlayframeworkSbt

Intellij Idea Problem Overview

I created a new Play Framework project using the activator, activator new my-project-name and then I selected the play-java template and the project is created with no errors.

Then I import the project into my IDE, IntelliJ, as a SBT project. When the project is imported a popup is shown saying: SBT compilation for play framework 2.x disabled by default.

On IntelliJ project's panel it doesn't show all (mostly the files with the code) files. Just a handful of them.

enter image description here

The build.sbt file looks like full of compilation error (pretty much all the lines are red underlined).

Here's the build.sbt file

name := """my-project-name"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayJava)

scalaVersion := "2.11.6"

libraryDependencies ++= Seq(

// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
routesGenerator := InjectedRoutesGenerator

fork in run := true

I can compile and run the code with activator ui with no errors. So, why isn't IntelliJ fully importing the project and it shows me SBT compilation for play framework 2.x disabled by default message?

I googled around and couldn't find any hint related to this so I'm kinda lost here.

EDIT: -------------------------------------

I closed the project on IntelliJ and deleted the project folder. Closed IntelliJ and using activator I created again the same project. Using activator ui I compiled the project. Then I fired up IntelliJ and was prompted to either open a project, create a new one or import a project.

Selected import a project and did the normal "import a project steps" and IntelliJ imported the project with no hassle. But if I try to import the project while with an open project on IntelliJ I get the same problem that lead me to make this question. Maybe this is a bug on IntelliJ?

EDIT 2 ------------------------------------------

The solution to these two problems (the "SBT compilation for play framework 2.x disabled by default" and the files not showing on IntelliJ) can be fixed with user3384225 and DarkShadow answers.

Intellij Idea Solutions

Solution 1 - Intellij Idea

Preferences > Languages & Frameworks > Play2

Under 'Compiler' enable 'Use Play 2 compiler for this project'

enter image description here

Solution 2 - Intellij Idea

I Stumbled upon this problem myself when configuring play framework for IntelliJ IDEA IDE (version: 2017.3). I overcame this problem by following the steps below.

Navigate to:

File --> Settings --> Languages and Frameworks --> Play2 --> Compiler tab

and inside the compiler tab:

put a tick to the Use Play2 compiler for this project

enter image description here

Hope this helped.

Solution 3 - Intellij Idea

Similar answer to user3384225's answer was posted here:

They say:

  • Settings -> Langauges & Frameworks -> Play2 -> Compiler -> User Play 2 compiler for this project

Solution 4 - Intellij Idea

I am also a newbie and was facing the same problem till yesterday. Probably you are trying to open the project through File->open.

Try the steps below:-

File->New->Project from existing source->select the build.sbt from the project you created using the activator->Import project from external model and select SBT from the options->OK.

It will take some time to import files and to create the settings required for intellij idea project. I am using intellij idea 14.1.5. It worked for me hope it will for you also.

Solution 5 - Intellij Idea

For current projects, you can fix this by using File->Invalidate Caches/Restart..

Solution 6 - Intellij Idea

Most probably you have solved you problem, but just to help others What you just have to do is -> check the option "Use Play 2 compiler for this project" given under Preferences -> Languages & Frameworks -> Play2 -> Compiler

Solution 7 - Intellij Idea

Close the project and then import the project as sbt project. Intellij will automatically dump and index the project dependancies.

Solution 8 - Intellij Idea

Stumbled upon the same problem today. Solved by wiping the ~/.IntelliJIdea14 directory. Unfortunately any other things I've tried didn't help.

Solution 9 - Intellij Idea

Just use: File->New->Project from existing source->select the build.sbt from the project you created using the activator->ok. and it's done.


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondazitoView Question on Stackoverflow
Solution 1 - Intellij IdeatgkView Answer on Stackoverflow
Solution 2 - Intellij IdeaSuleka_28View Answer on Stackoverflow
Solution 3 - Intellij IdeaPeteH32View Answer on Stackoverflow
Solution 4 - Intellij IdeaHenuView Answer on Stackoverflow
Solution 5 - Intellij Ideafallout1001View Answer on Stackoverflow
Solution 6 - Intellij IdeaanonymousView Answer on Stackoverflow
Solution 7 - Intellij IdeaYohan EView Answer on Stackoverflow
Solution 8 - Intellij IdeaIhor KaharlichenkoView Answer on Stackoverflow
Solution 9 - Intellij IdearkumarsView Answer on Stackoverflow