gpt4 book ai didi

maven-2 - Maven 插件在构建过程中多次执行

转载 作者:行者123 更新时间:2023-12-04 15:36:26 27 4
gpt4 key购买 nike

我有一个带有多个重叠配置文件的 Maven 项目。我想在每次构建开始时显示事件配置文件。所以我把以下内容放入pom.xml <build>部分:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<id>display-active-profiles-at-start-of-build</id>
<phase>validate</phase>
<goals>
<goal>active-profiles</goal>
</goals>
</execution>
</executions>
</plugin>

问题是插件在构建过程中多次执行:
  • 在构建开始时(在 validate 阶段)。
  • jar:jar执行。
  • source:jar/期间 pre-integration-test (?),当 Jetty 正在启动时。

  • 指定 <phase>initialize</phase> 时的类似结果.有没有办法让它只在构建开始时运行?

    最佳答案

    它执行多次的原因是因为您的一个插件正在执行另一个生命周期作为其魔力的一部分。
    source:jar绝对可以,正如 its documentation 所指定的那样.

    Invokes the execution of the lifecycle phase generate-sources prior to executing itself.


    jar:jar通常不会,但可能是您有另一个插件可以衍生另一个生命周期。

    在生成源 jar 的情况下,您通常不需要另一个生命周期,插件作者通过实现 jar-no-fork mojo 认识到这一点。 .

    您可以将其替换为默认值 jar mojo,按照此处描述的步骤 -> http://maven.apache.org/plugins/maven-source-plugin/usage.html

    关于maven-2 - Maven 插件在构建过程中多次执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8041610/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com