Maven发布目标绑定 [英] Maven release goals binding

查看:72
本文介绍了Maven发布目标绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个Redmine插件来更新某些项目的版本.为了避免手动操作,我想绑定到一些发布插件执行目标.通常,我需要在选择版本号时创建一个新版本,在选择新版本之前关闭以前的版本,依此类推...

I'd like to write a redmine plugin to update the version of some projects when they are released. To avoid manual steps, I'd like to bind to some of the release plugin execution goals. Typically, I need to create a new version when the version number is chosen, close the previous version before the new version is chosen, and so forth...

现在,我知道发布阶段不是典型生命周期的一部分,但是我怀疑可以像其他阶段(如集成前测试或集成后测试)一样钩住"它们

Now, I understand that the release phases are not part of the typical lifecycle, but I suspect that they can be "hooked" the same way as the other phases (like pre-integration-test or post-integartion-tests).

这是我尝试过的:

<execution>
    <id>prepare-release-test</id>
    <phase>maven-release-plugin:prepare</phase>
    <goals>
        <goal>list-issues</goal>
        <goal>list-versions</goal>
        <goal>list-users</goal>
        <goal>list-projects</goal>
    </goals>

<execution> 
    <id>prepare-test</id>
    <phase>maven-release-plugin:2.0:prepare</phase>
    <goals>
        <goal>list-issues</goal>
        <goal>list-versions</goal>
        <goal>list-users</goal>
        <goal>list-projects</goal>
    </goals>

但是这些都不起作用.绑定到测试阶段后,它便可以正常工作.

But none of those worked. WHen binding to test phase, it definelty works.

推荐答案

我知道发布阶段不是典型生命周期的一部分,但是我怀疑可以像其他阶段一样钩住"它们.

I understand that the release phases are not part of the typical lifecycle, but I suspect that they can be "hooked" the same way as the other phases.

它们不是阶段".它们是目标",并且它们唯一类似于阶段的方法是,您可以将其名称传递给Maven以便执行.您无法像将目标绑定到阶段那样将目标绑定到其他目标.通常,解决此问题的方法是定义您手动或自动激活 goals 属性可分别自定义release:preparerelease:perform期间发生的情况.

They're not "phases". They're "goals", and the only way they're like phases is that you can pass their names to maven for execution. You can't bind goals to other goals the way you bind them to phases. In general, the way you'd solve this is by defining a profile that you activate manually or automatically that modifies the default lifecycle bindings. If you want to go all-out, you could define your own lifecycle, too, but that seems like overkill. In the specific case of the release plugin, though, you also have the option of using the preparationGoals and goals properties to customize what happens during release:prepare and release:perform, respectively.

这篇关于Maven发布目标绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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