Can't get devtools auto build service working on Windows...
已回答
Hello,
As mentioned I'm trying to get auto build functionality configured for my Spring app as per these instructions:
1) add:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
to pom,
2) Settings: Build ,Execution, Deployment => Build Project Automatically
3) ctrl + alt + shift + / = Registry - Enable 'compiler.automake.allow.when.app.running, property.
I restart Intellij, rebuild my app and start, make a change to one of the beans, does not auto recompile.
what am i missing?
请先登录再写评论。
Do you save the file using Ctrl+S (Save All)?
yeah... tried this on a 2nd project and it seems to be working. However, (and this might have been the problem I thought I had on the prior project) it seem to take ~5 seconds after the source save before the rebuild kicks off. I may not have noticed that before.
At any rate it seems to be working now. Sorry for the false alarm.
Help | Find Action | Registry:
compiler.document.save.enabled — Specify whether project save in response to document changes is enabled
compiler.document.save.trigger.delay — Delay in milliseconds before triggering save in response to document changes
compiler.automake.postpone.when.idle.less.than — If at the moment the autobuild is about to start the IDE is idle for less than specified milliseconds, the automatic build will be postponed in order not to interfere with the user's activity
compiler.automake.trigger.delay — Delay in milliseconds before triggering auto-make in response to file system events
I tried adjusting all of the above and the time to rebuild is still the same. Which flag is it?
Anthony Alayo
> I tried adjusting all of the above and the time to rebuild is still the same.
None of these settings affect the rebuild time. If your issue is with the build performance, please open a ticket with support at https://intellij-support.jetbrains.com/hc/requests/new and provide more details.
Sorry if it wasn't clear -- I'm referring to the parameters you provided to tweak the delay with spring boot devtools. I tried tweaking all of the above parameters and yet I'm still seeing a delay when it comes to recompiling a small string change. Is there documentation to getting performant usage with devtools and IntelliJ?
Anthony A See my answer at https://stackoverflow.com/a/61416076/104891.
Serge Baranov I'm back at this a year later, and I'm not yet satisfied with the answer. Attempting to map save to the same shortcut as build is a hack / workaround. Can we get a setting in IntelliJ that allows us to configure the delay before auto build starts? Everywhere you look on the internet, people are experiencing 5~ seconds.
Anthony A You can try https://plugins.jetbrains.com/plugin/21538-save-actions-tool which has this feature:
- Compile project after save
Serge Baranov is there a reason we can't get native JetBrains support? Relying on 3rd party plugins isn't ideal, and on the plugin page it states build on save is experimental.
Anthony A If you want IDE to save your changes and start the build automatically on any modification, you have to change Settings (Preferences on macOS) | Appearance & Behavior | System Settings | Save files if the IDE is idle for to 1 and set compiler.automake.postpone.when.idle.less.than=0 / compiler.document.save.trigger.delay=0 in Registry.
And you also need to have Settings (Preferences on macOS) | Advanced Settings | Allow auto-make to start even if developed application is currently running enabled as well as Settings (Preferences on macOS) | Build, Execution, Deployment | Compiler | Build project automatically.
With these settings, if you make a modification in the file, the file will not be saved instantly, there will be still ~3 second delay before it's saved and the build is triggered (there appears to be some internal delay before the IDE is considered IDLE). However, if you press Ctrl+S to save the file, the build will be triggered almost instantly, see this video.
So, you don't have to map Ctrl+S to Build action, the regular Save action (automatic or manual) triggers the build pretty quickly as shown on the linked video.
That worked! Thank you!