mani mani - 4 months ago 5x
Java Question

Play Compilation time is too high

I am using the Play framework for my development. Each time when I compile, it takes a lot of time. Here's what the console outputs while compiling:

[info] Compiling 23 Scala sources and 2824 Java sources to E:\Project\Integrity_ Dev\target\scala-2.11\classes...

It takes at least 45 minutes for compilation to complete. How can I reduce this?


In general the most likely reason for this is that you by accident clean the build-directory for the java-files each time you recompile your project. You should check the build-script/configuration of your project.

Modern compilers - modern is rather broad here, in fact that's a pretty old feature - only recompile source code, if they can't find the compiled file, or the compiled file is older than the source code. So the simplest approach would be to exclude the build-folder for the java-code from cleaning or from the entire compilation-process at all except including it into the resulting build, if possible.

If you prefer, you can build a .jar from the .class-files and include that into your project. There's a manifold of possibilities to create .jar-files, including maven, ant, whatever IDE you use, etc.. The most generic one would be to build them via commandline.

A simpler way to solve this would probably be a maven-build though, that directly retrieves the files and builds them.