6

When I "junit" some class, compilation in Idea takes about 4-5 sec. In Eclipse it takes milliseconds.

What should I do to speed up Intellij Idea compilation for tests?

Péter Török
  • 114,404
  • 31
  • 268
  • 329
dmitrynikolaev
  • 8,994
  • 4
  • 30
  • 45

4 Answers4

4

Eclipse compiles on the fly (on save), so it does not have to do anything but to start the tests. Idea does not. Before starting the tests it has to make (compile all changed classes of the whole project). It is also not possible to start a test in idea when there is any compile error elsewhere in the project.

Arne Burmeister
  • 20,046
  • 8
  • 53
  • 94
4

I encountered such a problem using Gradle. Make sure that the tests run under Idea. Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Run tests using -> IntelliJ IDEA

stanley
  • 119
  • 1
  • 3
  • Also selecting "IntelliJ IDEA" for the option "Build and run using" (right next to "Run tests using") seems to help a lot on bigger projects. – Petr Bodnár Jun 03 '23 at 12:11
3

There is plugin in Idea plugin repository which solve exactly this problem!

dmitrynikolaev
  • 8,994
  • 4
  • 30
  • 45
0

I don't have IntelliJ in front of me but could it be that IntelliJ is set to do a clean compile before it runs the tests where Eclipse is set to do a make (I.e only compile changed classes)

Just a thought

Shawn Vader
  • 12,285
  • 11
  • 52
  • 61
  • check for module settings, idea settings: nothing. – dmitrynikolaev Jul 17 '09 at 08:13
  • I just started IntelliJ and I see a checkbox in the Run/Debug configurations which is Make so my original idea was wrong and make will only compile the changed classes. Some other things to check: 1) Are they using the same version of Java? This could make a difference. 2) Have you edited the eclipse ini file giving it more memory therefore running one ide with more memory than the other 3) Double check both run debug configurations for differences – Shawn Vader Jul 17 '09 at 08:46
  • Debug / Run - no difference. Maybe eclipse compile classes in background, but effictevly than idea (may be idea file cache play role) – dmitrynikolaev Jul 17 '09 at 08:58
  • By default Eclipse does a Make when you save a file so this means that the classes are probably all compiled buy the time you start the tests but if you make sure both are compiled before running the tests is IntelliJ still slower? Can you check the version of Java both are using? – Shawn Vader Jul 17 '09 at 09:03
  • Just to check. If you compile the IntelliJ project and in the Run/Debug un-check the Make before running tests. If it is still slower then it is not the compile. They are both using the same unit test package? – Shawn Vader Jul 17 '09 at 09:35
  • Other than that I reckon its a question for the IntelliJ team on http://www.jetbrains.net/devnet/community/idea/ideacommunity – Shawn Vader Jul 17 '09 at 09:37