Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Support for gradle play in 2.6.x release #81

Open
Munzey opened this issue Jan 25, 2018 · 2 comments
Open

[Request] Support for gradle play in 2.6.x release #81

Munzey opened this issue Jan 25, 2018 · 2 comments

Comments

@Munzey
Copy link

Munzey commented Jan 25, 2018

Hi,

since the changes in this release: #71 ,
If I create a play 2.6.x project (where I inject components in the template and inject the template at the controller level) and compile and run with gradle I am getting this exception once I reload the page:

Caused by: com.google.inject.ProvisionException: Unable to provision

followed by the errors "Could not find a suitable constructor..." in any controller which has a template that injects org.webjars.play.WebJarsUtil.
The app runs fine when I build with sbt.

In previous projects using play 2.5.x + gradle + webjars-play (where I injected WebJarAssets at controller level), the project compiled and ran fine.
The main discernible difference (from a user perspective anyway) is that the routes have changed:

i.e in a working play 2.5.x build I was using:
GET /webjars/*file controllers.WebJarAssets.at(file)

in the current failing play 2.6.x build Im using:
-> /webjars webjars.Routes

From a bit of googling it looks like using a split route file is something specific to the sbt play plugin:
not sure if there is a way to mimic this with the current gradle play plugin:
https://github.com/webjars/webjars-play/blob/master/build.sbt#L15

So I'm hoping you can help me out! A fix so that I can continue to use 2.6.x branch of play with latest webjars-play, or if supporting gradle is off the cards, could we have a documented workaround for this use case? Even if that just means adding some documentation to https://www.webjars.org/documentation#play2 (such as just extracting webjars to lib folder with task or plugin like https://github.com/ia-toki/gradle-play-webjars)

Thanks for the plugin!

@Munzey
Copy link
Author

Munzey commented Jan 26, 2018

on switching to https://github.com/ia-toki/gradle-play-webjars, it seems on further digging that my issue is also related to gradle play plugin not supporting injecting templates (still getting guice provision exceptions, but works fine when not using @this in templates).
Ill try find the correct place to open a discussion of this with gradle team

@jamesward
Copy link
Member

I haven't ever used the Gradle Play stuff but this project is definitely dependent on the latest Twirl and Play Routes compiler sbt plugins. I'm sure that those could be replicated as Gradle Plugins but I'm not sure what the state is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants