簡體   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