This is a tutorial on how to enable Dev Tools project on IntelliJ 2021.2 and observe the changes in code without having to restart the Tomcat server.
3 Answers
In order to make it work, you need to:
1)Have devtools enable in maven or gradle. In maven it looks like :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope><!-- -->
<optional>true</optional>
</dependency>
2)In IntellijIDEA: go in settings(ctrl +alt+s) -> Build,Execution,Deployment -> compiler, check "Build project automatically"
3) Enable option 'allow auto-make to start even if developed application is currently running' in Settings -> Advanced Settings under compiler
You can now restart your intelliJ IDE and start your application.

- 671
- 1
- 5
- 21
-
1If there is no Advanced Settings section you can try change registry flag from registry. 1- Double shift and search registry. 2- set true the value of compiler.automake.allow.when.app.running – AhuraMazda Aug 17 '22 at 08:13
1.file->settings->Build,Execution,Deployment->compiler->click->Build project automatically->apply->ok
2.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope><!-- -->
<optional>true</optional>
</dependency>
3.file->settings->advance option->allow auto make start even if developed application in currently running->apply->ok
4.restart IDE

- 45
- 1
- 6
Set Up your Project and IDE.
- Add the POM dependency.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
In IntellijIDEA: File -> Settings... -> Build, Execution, Deployment -> Compiler: Check "Build project automatically"
In IntellijIDEA: File -> Settings... -> Advanced Settings: Check "Allow auto-make to start even if developed application is currently running"
Set Up your Browser.
Add the "LiveReload" extension to your browser. Eg: if you are using Chrome Brower add the "LiveReload" extension by livereload.com.
Initially when you start your app, load in a browser tab and hover over the 'LiveReload' extension to ensure it is enabled. The tooltip should show as "LiveReload is connected, click to disable Has access to this site". LiveReload Tooltip
Once these are set up, to ensure both Automatic Restart and LiveReload;
- Do changes to both the Static files and Java files in the application that is already running.
- Build the project (Build -> 'Build Project' or Ctrl+F9).
- Observe the application automatically restarting with "LiveReload server is running on port .. " in the IDE console and the browser is refreshed.

- 19
- 1
- 7
-
I see a ClassPathChangedEvent in the logs when I run build, but the changes are still not reflected. For testing, I implemented a simple Spring Scheduler and changed the log message printed every second. And also, do I need to run Build Project whenever I change something? because that's not really any gain compared to restarting the application. Using Quarkus for example, it will apply code changes when the file gets changed automatically – Marian Klühspies Jan 18 '23 at 10:53