Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Idea "Make" causes rebuild while running JUnit Test

I am trying to move from Eclipse to Idea and having a hard time trying to execute JUnits. The application is a legacy application with 10k+ java classes.

Whenever I run any JUnit, either it takes 3-4 minutes to compile the test case and then executes it, or it gives a ClassNotFoundException for that particular JUnit class.

I have done a full build of the project (which takes about 9 minutes). I expect that after build only the modified files should be recompiled during "Make". And in my case, since I haven't changed any file, the JUnit should execute immediately.

I am using IntelliJ Idea 12 Community Edition and I have "Use External Build" checked in Compiler settings.

Am I missing any setting or doing anything wrong?

EDIT: While running the JUnit, I observed the output classes directory and it looks like it is deleting the generated classes and compiling them again!

like image 204
Manish Avatar asked Oct 23 '13 09:10

Manish


1 Answers

It turns out that IntelliJ IDEA does not like a single error in your whole project, even if the error is in some class which is totally unrelated to the test you are running. May be the Make process thinks the files containing compilation errors need to be recompiled. But even then why was it clearing the compiled classes and recompiling them is still a mystery to me.

The resolution to this problem was to make sure there is no error in your project. Once I fixed all the compilation errors and did a full rebuild, the tests now take about 2-3 seconds to launch.

like image 147
Manish Avatar answered Sep 19 '22 23:09

Manish