简体   繁体   English

IntelliJ 中的调试(重新加载更改的类)

[英]Debugging in IntelliJ (Reloading changed classes)

I recently switched from eclipse to IntelliJ.我最近从 eclipse 切换到 IntelliJ。 Eclipse's debug launcher used to reload the application instantly, whenever a class was saved. Eclipse 的调试启动器用于在保存类时立即重新加载应用程序。 IntelliJ takes more than 10 secs to reload changed classes, which might not be a lot, but it is annoying because I use it so frequently. IntelliJ 需要超过 10 秒来重新加载更改的类,这可能不是很多,但很烦人,因为我经常使用它。

How to make IntelliJ reload changed classes faster?如何让 IntelliJ 更快地重新加载已更改的类?

To reload changed classes重新加载更改的类

  1. Do one of the following:执行以下操作之一:
  • On the main menu, choose Run |在主菜单上,选择运行 | Debugging Actions |调试操作 | Reload Changed Classes.重新加载更改的类。
  • On the main menu, choose Build |在主菜单上,选择构建 | Compile "class_name" to recompile an altered class during debug.编译“class_name”以在调试期间重新编译已更改的类。
  1. In the Reload Changed Classes dialog box, confirm reloading.在“重新加载更改的类”对话框中,确认重新加载。 Results are displayed in the Messages tool window.结果显示在消息工具窗口中。

Refer this link for detailed explanation. 有关详细说明,请参阅此链接。

InteliJ is not recompiling the code after change in java files and rebuilding InteliJ 在更改 java 文件并重建后不会重新编译代码

  1. Project > Setting>Build,Execution,Deployment>Compiler>check "build project automatically"项目>设置>构建、执行、部署>编译器>勾选“自动构建项目”

  2. Ctrl + Shift + A find "registry", according to your requirements check the following: Ctrl + Shift + A找到“注册表”,根据你的要求勾选以下内容:

     compiler.automake.allow.when.app.running compiler.automake.trigger.delay=500
  3. Add devtool in pom.xml :pom.xml添加 devtool :

     <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency>
  4. Build, If found any probelm while building, saying some jar in not in class path.构建,如果在构建时发现任何问题,则说一些 jar 不在类路径中。 Just delete the corrupted jar and re-build the project angain after sync with maven libb只需删除损坏的 jar 并在与 maven libb 同步后重新构建项目

  1. Ctrl + Shift + A Ctrl + Shift + A
  2. type rcc (or "recompile changed classes")键入rcc (或“重新编译更改的类”)
  3. Hit enter按回车

next time you dont need to type, it will give the last run action下次你不需要输入时,它会给出最后一次运行的动作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM