Fabio Ebner
Fabio Ebner

Reputation: 2783

Intelijj IDEA springboot devtools

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

Upvotes: 4

Views: 6477

Answers (5)

Dishant Tanwar
Dishant Tanwar

Reputation: 39

refference to fix issue

do change onUpdate option in run/debug configuration in IntelJ

Upvotes: 0

Assegd
Assegd

Reputation: 106

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>

Upvotes: 0

Teodor Dimitrov
Teodor Dimitrov

Reputation: 1023

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

Upvotes: 6

Ben M
Ben M

Reputation: 1892

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/

Upvotes: 0

Kyle Anderson
Kyle Anderson

Reputation: 7051

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.

Upvotes: 1

Related Questions