tuplejump / play-yeoman

Play + Yeoman integration sbt and play plugins
Apache License 2.0
238 stars 57 forks source link

playRunHooks ClassNotFoundException re: sbt-yeoman GruntProcess #74

Open qberticus opened 9 years ago

qberticus commented 9 years ago

Play version: 2.3.8 Scala version: 2.11.1 sbt-yeoman: 0.7.1 using a build.sbt file

When using play-yeoman the addition of the GruntProcess to the playRunHooks setting causes a ClassNotFoundException during execution of the playRun task or show playRunHooks.

In order to add an additional PlayRunHook instances to playRunHooks it current requires setting playRunHooks := Seq() in the build.sbt file to remove the play-yeoman hook.

show playRunHooks output:

[trace] Stack trace suppressed: run last *:playRunHooks for the full output.
[error] (*:playRunHooks) java.lang.NoClassDefFoundError: play/PlayRunHook$class
[error] Total time: 0 s, completed Mar 28, 2015 4:48:14 PM

last *:playRunHooks output:

Caused by: java.lang.ClassNotFoundException: play.PlayRunHook$class
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at com.tuplejump.sbt.yeoman.Yeoman$Grunt$GruntProcess$2$.<init>(Yeoman.scala:160)
        at com.tuplejump.sbt.yeoman.Yeoman$Grunt$.GruntProcess$1$lzycompute(Yeoman.scala:160)
        at com.tuplejump.sbt.yeoman.Yeoman$Grunt$.GruntProcess$1(Yeoman.scala:160)
        at com.tuplejump.sbt.yeoman.Yeoman$Grunt$.apply(Yeoman.scala:174)
...
[error] (*:playRunHooks) java.lang.NoClassDefFoundError: play/PlayRunHook$class
tproenca commented 9 years ago

Same happening with me. Any workaround to get it working?

qberticus commented 9 years ago

Yea, I created my own grunt play run hook based on the one in play-yeoman as a temp solution. With this one you need to specify the grunt task to run. I did this since I use browserify with watchify and needed a custom task that runs browserify before watch.

https://gist.github.com/qberticus/232e821bc7ec6417fe69

tproenca commented 9 years ago

Thanks for the reply. When I add the content from the gist to the build.sbt, I got the following error:

playRunHooks := Seq()
^
[error] Type error in expression

Do you have any idea what went wrong?

tproenca commented 9 years ago

Found the import that was missing:

  import play.PlayImport.PlayKeys.playRunHooks

Thanks for your help on this :)

adridadou commented 9 years ago

Thank you for your fix! I will try that as I had the same issue. Would it be possible for you @qberticus to make a pull request with your playHook?