【问题标题】:How to run the maven plugin via cmd in the root directory without running this plugin in all modules?如何在根目录下通过cmd运行maven插件而不在所有模块中运行这个插件?
【发布时间】:2021-10-11 07:46:15
【问题描述】:

我们有一个插件需要通过cmd运行,例如:

mvn com.test.plugins:some-plugin:2.1.0:generate

有一个根pom.xml,有3个模块

<modules>
    <module>first</module>
    <module>second</module>
    <module>third</module>
</modules>

当插件以这种方式从根目录启动时,插件会在每个模块中启动 4 次。 我知道如果你在 pom.xml 中编写插件配置

<build><plugins><plugin>

我们可以使用标签

<inherited>false</inherited>

如何通过控制台执行此操作? 或者我们可以在插件的 Mojo 类中添加一些东西?

【问题讨论】:

标签: maven maven-plugin


【解决方案1】:

使用-N(或--non-recursive)命令行参数:

mvn -N com.test.plugins:some-plugin:2.1.0:generate

【讨论】:

    猜你喜欢
    • 2011-08-24
    • 1970-01-01
    • 2023-01-24
    • 2016-06-25
    • 1970-01-01
    • 2019-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多