Skip to content
Advertisement

Unable to resolve reverse routing methods in IntelliJ

I’m following one of the play framework tutorials, but I’m getting compile errors whenever I try to use reverse routing. Firstly,

public static Result javascriptRoutes() {
    response().setContentType("text/javascript");
    return ok(
        Routes.javascriptRouter("jsRoutes",
            controllers.routes.javascript.Projects.add(),
            controllers.routes.javascript.Projects.delete(),
            controllers.routes.javascript.Projects.rename(),
            controllers.routes.javascript.Projects.addGroup()
        )
    );
}

where the error shown in intelliJ is ‘cannot resolve method javascriptRouter(java.lang.String, ?, ?, ?, ?)’

But also in the a unit test:

@Test
public void notAuthenticated() {
    Result result = callAction(
            controllers.routes.ref.Application.index(),
            fakeRequest()
    );
    assertEquals(303, status(result));
    assertEquals("/login", header("Location", result));
}

where it cannot resolve the index method.

Is this a problem with intelliJ, or am I missing something within play?

For the first part, here is the entry in my routes file:

GET     /assets/javascripts/routes  controllers.Application.javascriptRoutes()

and my controller, Projects, has got the defined methods.

Advertisement

Answer

File -> Project Structure

Select Sources in Right Pane

Add Source folder

target/scala-XXX/classes_managed

target/scala-XXX/src_managed/main

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement