繁体   English   中英

build-helper-maven-plugin目标:正则表达式属性如何访问生成的属性

[英]build-helper-maven-plugin goal:regex-property how to access generated property

我尝试将项目版本解析为名为build-number的新变量,我使用以下插件

    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.7</version>
    <executions>
        <execution>
            <id>rename-property</id>
            <goals>
                <goal>regex-property</goal>
            </goals>
            <phase>package</phase>
            <configuration>
                <name>build-number</name>
                <value>${project.version}</value>
                <regex>\.</regex>
                <replacement>_</replacement>
                <failIfNoMatch>false</failIfNoMatch>
            </configuration>
        </execution>
    </executions>
</plugin>

我在pom.xml中的属性部分如下所示

 <modelVersion>4.0.0</modelVersion>

 <groupId>xxx.xxx.xxx</groupId>
 <artifactId>xxx</artifactId>
 <version>1.1.2</version>
 <packaging>rar</packaging>

 <properties>
     <build-number></build-number>
 </properties>

我的问题是在启动mvn build后我如何看到该变量

[INFO] --- build-helper-maven-plugin:1.7:regex-property(rename-property)@ xxx --- [INFO]将属性“ build-number”设置为“ 1_1_2”。

我发现,当我们设置阶段进行validate一切都很好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM