覆盖给定执行ID的Maven插件目标定义 [英] Overriding Maven plugin goal definition for a given execution id

查看:151
本文介绍了覆盖给定执行ID的Maven插件目标定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎不可能覆盖插件执行的目标定义。

It doesn't seem to possible to override a plugin execution's goal definition.

假设我有一个Jetty的父配置,定义一个

Let say I have a parent config of Jetty, that defines a

                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>

现在我想在本地为特定项目运行爆炸的目标

now I want locally for a specific project the goal run-exploded

如果我尝试用

                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run-exploded</goal>
                        </goals>
                    </execution>

那么我有效​​的pom变成了

then I have the effective pom becomes

                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                            <goal>run-exploded</goal>
                        </goals>
                    </execution>

我很惊讶,因为我一直以为它会覆盖。

I'm surprised, as I have always thought it would override.

这是Maven3中的一个新行为吗?

Is this a new behavior in Maven3 ?

有没有重叠的行为而不是当前的行为?

Is there anyway to get an overriding behavior instead of current one?

推荐答案

我发现的方法是禁用继承的配置并创建一个新的配置:

The way I found is to disable inherited configuration and creating a new one:

                    <execution>
                        <id>start-jetty</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>my-start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run-exploded</goal>
                        </goals>
                    </execution>

这篇关于覆盖给定执行ID的Maven插件目标定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆