首页 > 解决方案 > command "mvn spring-boot:run" does not take changes at run in other modules than main module?

问题描述

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 ?

标签: javamavenspring-boot-maven-plugin

解决方案


这就是 Maven 的工作方式,这与 Spring Boot 无关。当您进入module-main并运行命令时,它只会影响该模块,而 Maven 不知道该模块是一个更大的项目的一部分,如果需要,应该对其进行更新。

当您在特定模块中时,依赖项是通过本地 maven 存储库(而不是target/classes每个模块的单独位置)获取的。

与 Gradle 的工作方式相比,这是一个显着的区别(在模块中运行命令将在需要时自动更新同级模块)。


推荐阅读