Maven release goals binding

我的未来我决定 提交于 2019-12-25 04:56:21

问题


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).

Here is what I tried:

<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.


回答1:


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.

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.



来源:https://stackoverflow.com/questions/15185021/maven-release-goals-binding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!