How to stop auto rebuild of the project when I just need to compile a single class file in IDEA 19 Ultimate

已回答

I recently upgraded to IDEA 19. Since the upgrade I am noticing that even when I compile a single file or a single package, IDEA ends up compiling all JUnit tests module and other GWT modules. This didn't happen in IDEA 17. How can I stop this?

3

How exactly do you perform the compilation? Why do you compile the single class instead of using the incremental Build | Build?

Does the Build action always recompile even without any changes in the code?

Please share a sample to reproduce and the logs (idea.log/build.log): https://intellij-support.jetbrains.com/hc/articles/207241085.

You can upload the files here: https://uploads.services.jetbrains.com/.

1

I don't use the typical Artifact build process to rebuild the whole application. My IDEA is configured to place the compiled classes directly into the Webserver lib directory. The WebServer is connected to IDEA via a Remote connection so that any class changes are updated by HotSwap. As a result, If I make a small change in one java file, I don't need to rebuild the whole project. I just compile that one java file and go to the browser to test it.

 

At this moment i have all JUnit tests properly coded, so no compilation error. I just compiled 1 java file now and following is the IDEA.log file content.

Here is the data from the log files: -

2019-07-23 11:30:43,262 [5021965] INFO - rationStore.ComponentStoreImpl - Saving Project 'C:\Development\sapphire\HEAD\ideaconfigfiles' HEADRunManager took 18 ms
2019-07-23 11:30:43,342 [5022045] INFO - ij.compiler.impl.CompileDriver - COMPILATION STARTED (BUILD PROCESS)
2019-07-23 11:30:44,532 [5023235] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: C:/Program Files/JetBrains/IntelliJ IDEA 2019.1.3/lib/jps-launcher.jar;C:/Java/jdk1.8.0_181/lib/tools.jar
2019-07-23 11:30:44,596 [5023299] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2019-07-23 11:30:44,597 [5023300] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Defaulting to no-operation (NOP) logger implementation
2019-07-23 11:30:44,597 [5023300] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2019-07-23 11:30:51,521 [5030224] INFO - lij.compiler.impl.CompilerUtil - COMPILATION FINISHED (BUILD PROCESS); Errors: 0; warnings: 0 took 8196 ms: 0 min 8sec
2019-07-23 11:30:51,533 [5030236] INFO - s.CompilerReferenceServiceBase - backward reference index reader doesn't exist
2019-07-23 11:30:52,096 [5030799] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: C:/Program Files/JetBrains/IntelliJ IDEA 2019.1.3/lib/jps-launcher.jar;C:/Java/jdk1.8.0_181/lib/tools.jar
2019-07-23 11:30:52,146 [5030849] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2019-07-23 11:30:52,146 [5030849] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Defaulting to no-operation (NOP) logger implementation
2019-07-23 11:30:52,146 [5030849] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

 

 

I intentionally modified one JUnit test (unrelated to the java class) file so that it throws a compiler exception. I recompiled the same java file as earlier. Here is the log file: -

 

2019-07-23 11:31:09,717 [5048420] INFO - rationStore.ComponentStoreImpl - Saving Project 'C:\Development\sapphire\HEAD\ideaconfigfiles' HEADRunManager took 17 ms, TaskManager took 19 ms, XDebuggerManager took 12 ms
2019-07-23 11:31:09,744 [5048447] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 318 ms
2019-07-23 11:31:13,801 [5052504] INFO - rationStore.ComponentStoreImpl - Saving Project 'C:\Development\sapphire\HEAD\ideaconfigfiles' HEADRunManager took 16 ms
2019-07-23 11:31:13,873 [5052576] INFO - ij.compiler.impl.CompileDriver - COMPILATION STARTED (BUILD PROCESS)
2019-07-23 11:31:13,878 [5052581] INFO - j.compiler.server.BuildManager - Using preloaded build process to compile C:\Development\sapphire\HEAD\ideaconfigfiles
2019-07-23 11:31:18,219 [5056922] INFO - lij.compiler.impl.CompilerUtil - COMPILATION FINISHED (BUILD PROCESS); Errors: 1; warnings: 0 took 4354 ms: 0 min 4sec
2019-07-23 11:31:18,220 [5056923] INFO - s.CompilerReferenceServiceBase - backward reference index reader doesn't exist
2019-07-23 11:31:18,880 [5057583] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: C:/Program Files/JetBrains/IntelliJ IDEA 2019.1.3/lib/jps-launcher.jar;C:/Java/jdk1.8.0_181/lib/tools.jar
2019-07-23 11:31:18,937 [5057640] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2019-07-23 11:31:18,937 [5057640] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Defaulting to no-operation (NOP) logger implementation
2019-07-23 11:31:18,937 [5057640] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2019-07-23 11:31:23,886 [5062589] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 76 ms

 

This time, the compile failed, coz. it tried to recompile the JUnit test cases also.

 

I guess, I need to know how to modify the "HEADRunManager" process.

My Idea Project name is "HEAD" btw. And, if it matters, this project was initially created in old IDEA pre 14x build, then ported to IDEA 17 and later ported into IDEA 19.

0

Do you use Recompile action to compile the single file?

0

Yes, I use the "Recompile xxx.java" when compiling a single file OR the "Rebuild <default>" option when compiling multiple files/the whole package.

 

 

0

It's not clear why IDE recompiles JUnit tests when you recompile the unrelated single Java file unless your tests depend on it.

I'd recommend reporting a bug at https://youtrack.jetbrains.com/issues/IDEA with the logs attached, make sure to enable debug logging for build.log and attach it as well, not only idea.log. Specify exactly which file you've recompiled and which files were recompiled additionally to this file so that we can find it in the logs.

0

Thanks for the help. Will do.

0

I have similar issue when running unit tests, if i change 1 file and run the tests for it inteliJ will rebuild the whole project, it takes about 7 minutes to rebuild and my maven build takes 4 minuies.

Not sure what i can do to stop it.

 

This is the message that i get "Too many modules require recompilation, forcing full project rebuild"

 

That happens every time i change any code.

1

Wiliam Ferraciolli do you always build by IDE? Will it also make a full rebuild if you compile a single class file?

To make sure that the IDE build caches do not become corrupted between builds, if you have antivirus/firewall, try with it disabled or make sure that IDE settings directories, IDE installation home, IDE executable and project files are excluded from the scan.

Check that the IDE build process completes without errors.

If you still see an issue when you change only a single class and do not change any project structure settings (like adding/removing/changin libraries etc) but IDE rebuilds all project, please share a sample to reproduce and the IDE logs, see IntelliJ IDEA External Build logs section: https://intellij-support.jetbrains.com/hc/articles/207241085.

0

Had a similar very annoying test rerun on every single event trivial change. 

I accidentally clicked : “Rerun automatically”

0

请先登录再写评论。