How to improve compilation speed of Play Framework 2.0
Asked Answered
U

2

11

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

Ute answered 24/6, 2012 at 9:46 Comment(2)
Write more about simptoms. Although michiel's suggestions is correct, maybe you have other problem. I agree that after some time it getting slower and slower. In my case purging the unused memory and restarting the console helps for some time.Fenestrated
Nothing special, just that the compilation takes about 10 seconds when I open a URL in the browser.Ute
K
14

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)

Koser answered 24/6, 2012 at 9:50 Comment(2)
Play 2.1 is still slowFluviomarine
2.4. Still slow. Also, I've had problems running play ~run; it was causing some race conditions when I was manually refreshing the page along the auto compilation. Not funny.Gymnastics
N
1

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.
Niccolo answered 4/2, 2018 at 20:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.