4

I using Springboot to create my app, so in Springboot Doc says if I use devtools the tomcat will restart everty change in my code, but I use the maven panel to run my app just double click in spring-boot:run plugins, but when I change any code my tomcat don`t restart.

how can I fix this? tks

Fabio Ebner
  • 2,613
  • 16
  • 50
  • 77

5 Answers5

6

This a guide I used some time ago to make it work: https://www.mkyong.com/spring-boot/intellij-idea-spring-boot-template-reload-is-not-working/

Basically you have two do 2 things:

  1. Enable "Build project automatically" from Settings->Build, Execution, Deployment->Compiler
  2. Go to Registry(Ctrl+A, type "Registry") and enable compiler.automake.allow.when.app.running and ide.windowSystem.autoShowProcessPopup
Teodor Dimitrov
  • 1,003
  • 2
  • 12
  • 19
  • If you're using this for a webapp and testing on chrome don't forget to [install LiveReload to refresh the browser automatically](https://chrome.google.com/webstore/detail/remotelivereload/jlppknnillhjgiengoigajegdpieppei?hl=en-GB) – FearlessHyena Jan 19 '18 at 07:34
  • after that intellij starts restart all project after every save – ykembayev Jun 19 '18 at 05:06
1

With IntelliJ IDEA you'll need to build the project after making changes to your source code.

Build -> Build Project (Ctrl + F9)

That will trigger the restart.

Kyle Anderson
  • 6,801
  • 1
  • 29
  • 41
0

As per: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-devtools-restart

Triggering a restart

As DevTools monitors classpath resources, the only way to trigger a restart is to update the classpath. The way in which you cause the classpath to be updated depends on the IDE that you are using. In Eclipse, saving a modified file will cause the classpath to be updated and trigger a restart. In IntelliJ IDEA, building the project (Build -> Make Project) will have the same effect.

So it looks like because of the default way IntelliJ handles saves and builds, you will have to manually trigger the IntelliJ build to compile and update classpath while the application is running.

Another option is to enable automatic building while the application is running in IntelliJ.

One caveat if you’re an IntelliJ user like me, you’ll need to enable “Make project automatically” in the compiler preferences for automatic restarts to work. You’ll also need to enable the compiler.automake.allow.when.app.running registry setting in IntelliJ. You can access the registry in IntelliJ using the shortcut Shift+Command+A, then searching for registry.

https://patrickgrimard.io/2016/01/18/spring-boot-devtools-first-look/

Ben M
  • 1,833
  • 1
  • 15
  • 24
0

For my case, i am using this dependency on maven and it does the things listed on the comment and also enables live reload

<!-- hot swapping, disable cache for template, enable live reload -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>
Assegd
  • 106
  • 18
0

refference to fix issue

do change onUpdate option in run/debug configuration in IntelJ