简体   繁体   中英

slow compilation of play framework with scala project in intellij

I'm using intellij 13.1.4.

When creating a play 2 project directly from intellij I compile it and it takes around 9 secs. This happens even when compiling a single source.

Is there a known issue or something I should configure to improve compilation process?

I'v been experimenting with scala for some time. I'm new to intellij, play and sbt.

Thank you in advance.

Notes: I opened http://youtrack.jetbrains.com/issue/IDEA-129515 in jetbrains related to this question. I also tried a workaround associated with slowness with java compiler; but no result. This question's body was updated substantially because I got confused initially: I thought it took 2 secs to compile a project generated with idea, when in reallity it was not compiling anything. I tried invalidating caches but got the same result. So, that project is broken.

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 of your entity models (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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM