[英]Check if Maven pom is SNAPSHOT
I need a way to set a property is.snapshot
to 0
if project is currently a SNAPSHOT version, otherwise set the property to 1
. 如果项目当前是SNAPSHOT版本,则我需要一种将属性
is.snapshot
设置为0
,否则将属性设置为1
。
My attempt was to use the build-helper-plugin 我的尝试是使用build-helper-plugin
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>version-helper</id>
<goals>
<goal>regex-property</goal>
</goals>
</execution>
</executions>
<configuration>
<name>is.snapshot</name>
<value>${project.version}</value>
<regex>.*(-SNAPSHOT)$</regex>
<replacement>0</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</plugin>
If project.version
is SNAPSHOT the is.snapshot
property is set to 0
. 如果
project.version
是SNAPSHOT,则is.snapshot
属性设置为0
。 This works fine. 这很好。 However, if
project.version
is not a SNAPSHOT the property gets set to the project.version
. 但是,如果
project.version
不是SNAPSHOT,则该属性将设置为project.version
。
Any way to correct this or is there another plugin I could use? 有什么办法可以解决这个问题,还是我可以使用另一个插件?
如果确实需要,可以手动设置rpm-maven-plugin的发行版本 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.