Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to improve compilation speed of Play Framework 2.0

Has someone already found some tweaks to improve the compilation speed of Play 2.0? I am currently using 2.0.1 java.

like image 358
Andreas Ka Avatar asked Jun 24 '12 09:06

Andreas Ka


2 Answers

I have written a very long post about how we have fix the compilation problem in Play Framework with my team.

https://medium.com/@jfcote/the-ultimate-solution-to-play-framework-slow-compilation-53f4fd499df4

To summarize,

  • Add this to build.sbt: playEnhancerEnabled := false
  • Using a refactoring tool, encapsulate each field (making them private, generating a getter and changing the use everywhere for the newly created getter). Generate only a setter for fields that are used outside of the class (you will know by compiling and see the errors)
  • Make sure to remove the @Transient annotation for all functions that are marked with it. We had these annotations on some functions because it was clashing with the Play Enhancer. Just remove the annotations and everything will be OK!
  • Compile and fix everywhere you were using the field if the refactoring tool didn’t do its job.
like image 185
Jean-François Côté Avatar answered Jan 03 '23 17:01

Jean-François Côté


You can use play ~run. This compiles the files as soon as a change is deteced on the filesystem.

Plus there are rumors about a big compilation boost coming in the next couple of months. (latter half of 2012)

like image 32
i.am.michiel Avatar answered Jan 03 '23 16:01

i.am.michiel