相关疑难解决方法(0)

Maven:将插件执行绑定到另一个插件的执行,而不是生命周期阶段

关于接受答案的说明:由于强有力的间接证据,我接受了答案.尽管如此,这是间接的证据,所以要带上一粒盐.


当用户运行插件目标而不是生命周期阶段时,如何触发插件?(之前已经问过,但答案是使用生命周期阶段.)

例证:我需要release:branch调用regex-plugin以生成一个当前版本作为其名称的分支,减去-SNAPSHOT后缀.这就是我所拥有的,它要求开发人员激活配置文件并调用verify阶段.我需要开发人员简单地调用release:branch,这反过来应该导致regex-plugin运行.与Gitflow有点结婚.

<profile>
    <id>Release Branch</id>
    <build>
        <plugins>
            <!-- On validate, compute the current version without -SNAPSHOT. -->
            <!-- Put the result in a property. -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>regex-property</goal>
                        </goals>
                        <configuration>
                            <value>${project.version}</value>
                            <regex>^(.*)-SNAPSHOT$</regex>
                            <replacement>$1</replacement>
                            <name>project.unqualifiedVersion</name>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Also on validate, run the branch plugin, and use -->
            <!-- the non-SNAPSHOT version thus computed in the …
Run Code Online (Sandbox Code Playgroud)

maven maven-release-plugin git-flow

22
推荐指数
2
解决办法
9110
查看次数

标签 统计

git-flow ×1

maven ×1

maven-release-plugin ×1