Play 2.3.10 Java project and Twirl default imports

Hi,

I’m currently trying to migrate a project using Java and the Play framework (2.3.10) from SBT to Gradle.

Unfortunately it seems that the Twirl compiler (which is being used to compile the templates of the project) is always using the default Scala imports instead of the default Java imports which results in a lot of compile errors in the compilePlayBinaryScala task.

I’ve looked into the code of the Gradle Play platform support and it seems that this setting is hard-coded right now: TwirlCompile (and subsequently TwirlCompilerAdapterV10X).

Is it somehow possible to override this setting anyway? I would even resort to using reflection until the Gradle Play plugin also supports Play projects using Java. :wink:

It also seems like the 3rd party Gradle Twirl plugin supports this setting, so I would be fine with using that for compiling the templates in this project instead of Gradle’s implementation if that was somehow feasible.

Cheers,
Jochen

I’ve created a small pull request to make the required setting configurable: https://github.com/gradle/gradle/pull/523