IntelliJ社区版spring-boot-devtools无法自动重启,需聚焦窗口才生效的解决办法
IntelliJ社区版Spring Boot DevTools自动重启/重载问题
我希望在IntelliJ社区版中通过spring-boot-devtools启用自动重启/重载功能,已在Maven依赖中添加如下配置:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency>
控制台显示devtools已正确初始化(比如Live Reload服务器已启动),但修改Java类或resources目录下的静态文件时,从未触发自动重启/重载。我可以通过Build > Build Project手动触发重启/重载,但由于主要在VSCode窗口处理JavaScript文件(IntelliJ社区版不支持该类文件),因此需要实现自动触发。
已尝试的解决方案
- 开启
Settings > Build, Execution, Deployment > Compiler > Build project automatically - 开启
Settings > Advanced Settings > Allow auto-make to start even if developed application is currently running - 在application.yml中配置
devtools: restart: enabled: true确保重启功能启用 - 重新加载Maven依赖
- 重装IntelliJ
但以上操作均无法实现自动重启。
环境信息
IntelliJ IDEA 2023.3.2 (Community Edition) Build #IC-233.13135.103, built on December 20, 2023 Runtime version: 17.0.9+7-b1087.9 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 11448M Cores: 24 Non-Bundled Plugins: Statistic (4.2.14) Lombook Plugin (233.13135.65) izhangzhihao.rainbow.brackets (2024.1.0-233) org.sonarlint.idea (10.2.1.77304) Kotlin: 233.13135.103-IJ
更新
我发现自动重启/重载功能是有效的,但必须在VSCode中修改文件后聚焦IntelliJ窗口才会触发。请问如何让IntelliJ在窗口非聚焦时也能检测到变更?
内容的提问来源于stack exchange,提问作者Brodie Griggs
相关产品推荐
相关产品推荐

