Moving from SBT to Gradle for Play apps


#1

Hi,

I’m trying to move from SBT to Gradle so I have the same setup on all my applications.
The first app I migrated works fine, but, for some reason, I can’t manage to do the same with a second one.

This app was first using Play 2.5, and I moved it to 2.6.20 before moving to Gradle.
SBT compiles with 2.6.20 without any warning, and yet, using the Play plugin, I get a lot of errors with Gradle. Mostly classes and methods it doesn’t know.

not found: value Locale
“”"),display(/65.18/defining(Locale.forLanguageTag(market))/65.57/ { locale =>display(Seq[Any](format.raw/65.69/("""

Cannot find any HTTP Request Header here
“”"),display(/231.30/defining(CSRF.getToken.getOrElse(sys.error(“No CSRF token present!”)))/231.100/ { token =>display(Seq[Any](format.raw/231.111/("""

package play.api.mvc.request is not a value
<input type=“hidden” class=“ffExclude” name=“fp1” value=""""),display(/248.87/DigestUtils/248.98/.sha1(request().remoteAddress() + “|” + request.header(“X-Real-IP”).getOrElse(""))),format.raw/248.180/(""""/>

java.util.List[String] does not take parameters
th class=“small align-middle” scope=“row”>"""),display(/122.69/stat(0)),format.raw/122.76/("""

not found: value Locale
“”"),format.raw/129.29/(""“h5 class=“text-center”>”""),display(/129.54/month/129.59/.format(DateTimeFormatter.ofPattern(“MMMM yyyy”, Locale.forLanguageTag(“en-us”)))),format.raw/129.140/("""

Any idea what’s happening ?
Could it has something to do with a Java/Scala duality ? How could I fix it ?

Thanks a lot for your advice :slight_smile:


#2

Hi again,
I have some more news, or at least a smaller issue.

Building it with SBT works like a charm, but fails with Gradle.

object getHeader is not a member of package play.api.mvc.request

I had a look in an IDE.
With Gradle, as mentioned above, “@request” returns a play.api.mvc.request whereas, with SBT, I see a “Http.Context.Explicit” coming from “play.mvc” package.

Any insight ?
Thanks a lot