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.
In order to make it work, you need to:
- 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>
In IntelliJ IDEA: go to settings(ctrl + alt + s) -> Build, Execution, Deployment -> Compiler, check "Build project automatically"
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.
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
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.
© 2022 - 2024 — McMap. All rights reserved.