【发布时间】:2019-10-26 14:29:11
【问题描述】:
构建主项目时如何运行子模块插件目标
我想在构建项目后运行spring-boot插件,但是spring-boot插件只添加在子模块中,有什么解决办法吗?永远感谢!
main-project
pom.xml
spring-boot plugin not added in the main pom.xml
module1
pom.xml
module2
pom.xml
depend on module1
spring-boot plugin added
当我运行命令时
mvn clean install -pl module2 -am spring-boot:run
maven 抛出异常
[ERROR] No plugin found for prefix 'spring-boot' in the current project and in the plugin groups
【问题讨论】:
-
你为什么要这样做?而不是只执行多次maven?
-
你建议我可以构建所有模块
mvn clean install然后cd module2mvn spring-boot:run这可以工作,但我只想运行一次 mvn 命令来运行 spring-boot:run 目标. -
为什么?如果您这样做
mvn clean install && cd module2 && mvn spring-boot:run,那么您也可以在一行中完成所有操作。我假设您的主项目有一个模块部分,因此它将构建所有模块。 -
好主意,我只需要在一行中写命令,大声笑,谢谢:-)
-
很高兴您喜欢我的回答。我将此添加为答案,如果您能接受此作为正确答案,我将不胜感激。谢谢
标签: java maven spring-boot spring-boot-maven-plugin