Arne Claassen
Arne Claassen

Reputation: 14404

Resolving Controllers via routes for imported Play 2.4.x project in IntelliJ

I'm trying to import any Play project (usually from activator) into IntelliJ and each time I end up with Controllers not being resolved, i.e. you go to conf/routes and routes.ApplicationController shows up red and inside any Controller completion for routes. shows no controllers.

The projects do compile in, and even run from IntelliJ, but compiled routes just aren't picked up.

I don't know if it's related, but on project load I always get the following message:

SBT compilation for play framework 2.x disabled by default

But even if I go into the Languages & Frameworks setup and tell it to use the Play 2 compiler, the routes are not affected.

Upvotes: 0

Views: 216

Answers (1)

w4tson
w4tson

Reputation: 337

Hüseyin Zengin is right. The activator plugin which generates the .idea directory and metadata is no longer 'the way'.

The truth is it doesn't work perfectly out of the box and your best bet is to get on the latest versions of all three. This means using the Early Access Program version of Intellij.

This largely depends on the versions of Play!, Intellij and the Scala (formerly Play) plugin.

If you can't do that or still get the problem anyway then following these steps might help:

Open your Play! 2.x project in Intellij Open Module Settings F4 In the Root Source Settings navigate the directory structure.

Add the main directory at

target/scala-/routes/main

to the Source Folders list. Right clicking the main folder and selecting Sources is one way to do this.

Upvotes: 1

Related Questions