2
votes

I am using PlayFramework and Scala for my project.

I have upgraded my application from play 2.5 to play 2.6 version.

In project I already have custom package called "utils".

The project compiles and runs fine. but when I open project in IntelliJ the the twirl template html files gets error. It says package not recognized.

When I go to twirl template file(e.g index.scala.html) where I have imports from this package e.g { @import utils.XYZHelper }, using (cmd+ mouse arrow), it points to name of play.api.utils package instead of my own custom utils package.

Its conflicting with "play.api.twirl.utils" instead of my own custom "utils" package. Its not good idea to use "root.utils " everywhere in project just IntelliJ can not resolve it properly.

Any suggestion or advice would be helpful.

1
Just for information, i have already tried sbt clean, manully deleting target & project/target and recompile, nothing solves this - aniketk

1 Answers

0
votes

I know this is an old one, but I thought I should add the solution anyway if anyone else has the same problem. This isn't just a problem with IntelliJ Idea, so you have to import with an absolute resolution, use the _root_ prefix. Like this:

@import _root_.utils.BlaBla

Ref. https://www.playframework.com/documentation/2.8.x/JavaTemplates