【问题标题】:How to add other goals as dependencies for a custom maven plugin? [duplicate]如何添加其他目标作为自定义 Maven 插件的依赖项? [复制]
【发布时间】:2019-02-12 05:04:37
【问题描述】:

我正在为 Maven 编写一个插件。但是,只有在运行 mvn compilemvn test-compile 之后运行我的插件才有意义。如何确保这些目标在我的插件目标之前运行?

以下是我正在使用的当前注释参数,但它们似乎没有达到预期的效果。

@Mojo(name = "testplugin",
      defaultPhase = LifecyclePhase.TEST,
      requiresDependencyResolution = ResolutionScope.TEST)

【问题讨论】:

    标签: java maven maven-plugin


    【解决方案1】:

    还有另一个注解@Execute (https://maven.apache.org/plugin-tools/maven-plugin-plugin/examples/using-annotations.html) 可用于此目的。在这种特殊情况下,您需要添加以下注释:

    @Execute(phase = LifecyclePhase.TEST_COMPILE,
             goal = "test-compile")
    

    【讨论】:

      猜你喜欢
      • 2020-11-24
      • 2012-01-20
      • 2014-07-01
      • 1970-01-01
      • 2020-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-13
      相关资源
      最近更新 更多