Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building tests in Intellij for Play Framework is very slow

Is there a way to speed up the build time of unit tests for Play Framework in Intellij? I am doing TDD. Whenever I execute a test, it takes about 30 - 60 seconds to compile. Even a simple Hello World test takes time. Rerunning the same test even without any change will still start the make process.

I am on Intellij 14.1, on Play 2.3.8, written in Scala.

I already tried setting the java compiler to eclipse, and also tried setting Scala compiler to SBT.

like image 835
jespeno Avatar asked Apr 21 '15 07:04

jespeno


1 Answers

In intellij 14.1.2, the workaround I did is to:

1) Remove make from tests (Edit Configurations -> Defaults -> Scala Test -> Before launch -> (-) Make)

2) Start activator (or play) with ~ test:compile (ex: activator ~test:compile) or (sbt ~ test:compile)

This prevents Intellij from calling a play compilation server every time a make is invoked. The compilation is delegated to an external sbt/activator/play process to do the continuous compilation. The disadvantage is that, when you run your test immediately before the compilation completes, you may get a NoClassDefinedFound exception. Also, you will need to monitor an extra process. This setup however, is so much faster compared to the default setup by Intellij (for now). Hope this helps anyone.

like image 139
jespeno Avatar answered Oct 25 '22 14:10

jespeno