首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >build-helper-maven-plugin目标:regex- property如何访问生成的属性

build-helper-maven-plugin目标:regex- property如何访问生成的属性
EN

Stack Overflow用户
提问于 2018-08-20 18:04:53
回答 1查看 1.2K关注 0票数 0

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

代码语言:javascript
复制
    <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中的属性部分如下所示

代码语言:javascript
复制
 <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构建后,我可以看到

INFO - build-helper-maven-plugin:1.7:regex-property (rename- property ) @xxx- INFO将属性'build-number‘设置为'1_1_2’。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-08-29 21:22:42

我发现,当我们将阶段设置为validate时,一切都会正常工作。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51928372

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档