Hotswap with "Reload changed classes" targets every class in my project without warning

Answered

The action "Reload changed classes" will allow me to recompile some classes in my project. However, the behavior of this option is extremely unpredictable. Sometimes it will properly recompile only the class that I have edited, but other times it will try to reload every single class in my project--and there's absolutely no warning beforehand as to which will occur. I simply have to try it and see, and cancel out the process if it seems it will reload everything, or else I will be sitting there for several minutes waiting for intellij to finalize what I could have done myself in a single minute.

There are particular days where this happens more than others. Some other days the feature works every time, but today I can't get it to hot swap a single class without it recompiling my entire project. Is there any way for me to have more insight as to what's going on, and why the "Reload changed classes" feature randomly stops working? This is a real productivity killer.

Edit: as an added note, in these cases it seems like "rebuild" on a single class will hotswap it successfully.. so there's something about "Reload changed classes" that is being overeager in choosing classes to reload?

 

My info:

IU-183.5912.21, JRE 1.8.0_152-release-1343-b28x64 JetBrains s.r.o, OS Windows 10(amd64) v10.0 , screens 1920x1080, 1920x1080, 1280x720

 

5
11 comments

Hi.

Could you please provide idea.log and build.log after reproducing a problem?

0
Avatar
Permanently deleted user

This is happening to me every single time I recompile. I have 2019.2.4, I did not have this issue when I was running 2017 version.

 

0

This exact happens to me. After idea update around 2019.2 IntelliJ doesn't reload single changed class during debugging, only rebuild and reload all classes in the project.

0

Do you use any build tool (Maven, Gradle)? What is your project type?

0

This issue solved itself with an IDE upgrade :/

0

I am using gradle, but I did some investigation and looks like this is due complexity of project based on gradle. The things affect the issue, I assume non default path to resources in build folder. I have made a new clear gradle projects and it does works as expected.

0

Same issue here.

Today I upgraded from 19.3 to 20.2 and this started happening. We are using Gradle to build our project.

Some coworkers tried out IntelliJ 20.1 some months ago and encountered the same issue. After they downgraded, they had no more issues, but we don't wanna be locked out of the 20.x version in the long term.

0

Try building with IntelliJ IDEA instead: https://i.imgur.com/HpeUaUE.png.

1
Avatar
Permanently deleted user

Thank you, Serge - that did the trick. That'll make a big difference!

0

Just specifying that "building with IntelliJ IDEA" also meant that I had to build from the IntelliJ menu (Build | Build/Rebuild Project action). I made the mistake of building through command line a long time a go and thinking that starting the Spring Boot app from the services tab in IntelliJ will also rebuild using IntelliJ.

After this hot swapping works and it indeed made a big difference.

0

I just wanted to follow up and mention that this occurred for me in the past without anything gradle-related in my project, however intellij's bundled gradle plugin was probably active.

Also the "single hotswap" plugin from LabyMedia has been useful for faster single-class hotswaps.

0

Please sign in to leave a comment.