gradle :compilePlayBinaryPlayRoutes is not generating all imports

Viewed 365

I am switching a play app from SBT to gradle and the routes and reverse routes scala files are not being generated with

import _root_.play.libs.F

which is causing

build/src/play/binary/routesScalaSources/controllers/ReverseRoutes.scala:260: not found: value F
def validate(accountId:F.Option[java.lang.Long]): Call = {

I am using gradle 3.5, play: '2.4.8', scala: '2.11' and java: '1.8'. Does anyone know if there is a compatibility issue with or some other known issue that is stopping the import from being added to the generated scala file?

** EDIT **

I found this class RoutesCompile with a method additionalImports but I can't find how to use it in the build.gradle file. (I am super new to gradle, more of a maven guy)

** EDIT 2 **

Based on the Javadoc in the RoutesCompile class it seems like I should be adding it to the model like this:

model {
  components {
    play {
        platform play: '2.4.8', scala: '2.11', java: '1.8'
        injectedRoutesGenerator = true
        additionalImports = ['play.libs.F']
        sources {
            twirlTemplates {
                defaultImports = TwirlImports.JAVA
                source.srcDir "assets/views"
                source.exclude "assets/stylesheets"
            }
        }
     }
   }
}

But I get the following error:

> Exception thrown while executing model rule: play { ... } @ build.gradle line 147, column 9
> No such property: additionalImports for class: org.gradle.play.PlayApplicationSpec
1 Answers
Related