Controllers.routes cannot be resolved: at redirect(controllers.routes.Application.login())

Hi All,

I recently migrated our Play 2.2.6 application to Play 2.7.x.

I am new to Play and trying to resolve a compile error inside the controller RecoveryManagement.Java. In this controller I am trying to perform a redirect operation like below:

return redirect(controllers.routes.Application.login());

The error is that controllers.routes cannot be resolved.

As per the play 2.7 documentation for reverse routing we can the Action login() by using “controllers.routes.Application” reverse controller and each controller package has a routes subclass.

I am importing what is required

import play.*;
import play.mvc.*;

conf/routes has the below setting

# login action
GET   /                          controllers.Application.login()

Documentation Referred to -
https://www.playframework.com/documentation/2.7.x/JavaRouting

I think that there is something I am missing and hoping that experts in this forum could help me figure this out.

1 Like

I am seeing the same problem and would appreciate any help.

Hey @aghomotam and @Kenye,

Not sure what is happening. Are you able to create a small project to reproduce the problem?

Best.

It’s not something that can be reproduced. It’s a compiler error. Is there any other info that you need?

Hi,

I assume you mean conf/routes and not routes/Conf?
Anyway, have you tried to do a clean and then compile in SBT? I have seen different kinds of compilation errors if I do changes to a routes file and forget to do a clean & compile.

Eirik

Yes, I guess that was a typo. We have tried clean compiles.

Hey @Kenye,

What I meant is, can you create a small project where the compilation problem happens and share it?

Best.