IntelliJ IDEA “Build project automatically” apparently not working

霸气de小男生 提交于 2021-02-08 01:51:20

问题


I am a long-time Eclipse user for Java and I am used to seeing compilation errors and warnings in the "Problems" view as soon as I cause them.

Now I am using IntelliJ IDEA (Kotlin and Java). There is a "Problems" view, but it often stays empty even if there are errors or warnings showing on the margin of my code window.

The errors are warnings are listed on "Problems" if I pressed Ctrl-F9 for "Build Project" but I would like that to happen automatically.

I've selected "Settings" -> "Build, Execution, Deployment" -> "Compiler" -> "Build project automatically", but that does not seem to make a difference.

StackOverflow shows Intellij IDEA Java classes not auto compiling on save as a possible related question, but the chosen answer doesn't work for me. Besides being quite old, that answer says that "Build Project Automatically" only works "if you are using the external compiler option", but I don't know what that is (a search for "external compiler" on IntelliJ's documentation does not return anything relevant) and my settings don't mention it. And the answer does not say what to do if you are not using such option anyway.

So, how can I see errors and warnings listed automatically as I modify the code in IntelliJ IDEA?


回答1:


Build project automatically is only works while not running / debugging as you can see in next to it's setting.

But you can set some enhancements. You can enforce automatically building if application is not running:

  • (Build, Excecution, Deployment / Compiler / Build project automatically)
  • Save files automatically if application is idle for ? sec.

If application is running: For example when you want to run a Spring boot app:

  • Run/Debug Configuration / Spring boot / Running Application Updates Policies:
  • Set for On frame deactivation to Update classes and resources. So if you change the focus to outside the IDE window, the project will rebuild.

If you are running an Application server, for example a Tomcat:

  • You can set On 'Update' action to Update classes and resources too. See how it works in link below.

Updating an application in IntelliJ



来源:https://stackoverflow.com/questions/53704021/intellij-idea-build-project-automatically-apparently-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!