Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring-boot-devtools doesn't reload dependent modules in multi-module maven project

Before I start, I'd like to say that I already tried the solution proposed in spring-boot-devtools reload of multi-module maven project changes, which didn't work for me.

Problem:

I have a multi-module Spring Boot project of this sort:

enter image description here

The module launcher has a Maven dependency on module GUI. I launch my Spring Boot application from the main method in launcher.

When I run the application and change any HTML file in GUI module, the spring-boot-devtools dependency doesn't do a live reload of these changes for my running application. Not even manual restart of launcher helps. I need to compile GUI manually and then run launcher again.

What I tried:

  1. I tried defining the spring-boot-devtools dependency first in parent pom.xml, then in GUI module only and then in both at the same time.
  2. I tried adding spring.devtools.restart.additional-paths=../gui in my application.properties file as suggested in spring-boot-devtools reload of multi-module maven project changes. This does indeed trigger the reload (according to the log), but those changes just don't propagate to the jar file of GUI dependency. Also, before I even made this project into multi-module, there was no need for reloading just because of HTML files (nothing is being compiled) and I could see the changes right away.

I use Netbeans GUI if that's of any help. I also tried running the project from command line, with no success. The Maven packaging on all modules is set to jar.

like image 911
Saraph Avatar asked Oct 13 '17 10:10

Saraph


1 Answers

The fact that this works when you configure absolute paths in devtools tells me that this is mainly a work directory issue.

So this means that:

  • configured paths should be relative to where you launch the CLI
  • you should configure the same location as a work directory in the run configuration of your IDE (whatever configuration your IDE is using to launch your application should have such an option)

In your case: everything should be relative to your launcher module; this should be as well your work directory in your IDE.

like image 187
Brian Clozel Avatar answered Oct 18 '22 10:10

Brian Clozel