【问题标题】:How can I run child module plugin goal when I build the main project?构建主项目时如何运行子模块插件目标?
【发布时间】: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 module2 mvn spring-boot:run 这可以工作,但我只想运行一次 mvn 命令来运行 spring-boot:run 目标.
  • 为什么?如果您这样做mvn clean install && cd module2 && mvn spring-boot:run,那么您也可以在一行中完成所有操作。我假设您的主项目有一个模块部分,因此它将构建所有模块。
  • 好主意,我只需要在一行中写命令,大声笑,谢谢:-)
  • 很高兴您喜欢我的回答。我将此添加为答案,如果您能接受此作为正确答案,我将不胜感激。谢谢

标签: java maven spring-boot spring-boot-maven-plugin


【解决方案1】:

如果你这样做了

mvn clean install && cd module2 && mvn spring-boot:run 

你也可以在一条线上。

我假设您的主项目有一个模块部分,因此它将构建所有模块。

【讨论】:

  • 更好mvn clean install 之后mvn -pl module2 spring-boot:run...
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-03-28
  • 2021-05-02
  • 1970-01-01
  • 2013-10-25
  • 1970-01-01
  • 2012-12-08
  • 1970-01-01
相关资源
最近更新 更多