command "mvn spring-boot:run" does not take changes at run in other modules than main module?

3.2k views Asked by At

i have a multi-modules maven, which is configured like that :

  sub-module maven : modul-main : contains the Main class and config folder with an application.properties file
  sub-module maven : modul-common : an another sub-module 

if i update my code in modul-main, so the command

   mvn spring-boot:run 

see my changes at run but IF i update my code in modul-common, so the command

   mvn spring-boot:run 

does not see my changes!

  1. how explain that ? (what the command does in background ?) want to understand !
  2. is there an option with this line command to solve this ?
1

There are 1 answers

2
Stephane Nicoll On

That's how Maven works and this has nothing to do with Spring Boot. When you are in module-main and you run a command, it only impacts that module and Maven is not aware this module is part of a larger project that should be updated if necessary.

When you are in a particular module, dependencies are picked up via the local maven repository (not the individual target/classes locations for each module).

This is a significant difference compared to how Gradle works (running a command in a module is going to update sibling module automatically if needed).