[英]build-helper-maven-plugin goal:regex-property how to access generated property
[英]Maven build-helper-maven-plugin regex unable to use property as dependency.version
我正在尝试使用 build-helper-maven-plugin 正则表达式来转换默认属性,然后再将其用于依赖项部分。
我的 pom.xml 文件属性部分看起来像这样......
<properties>
<some.version>114.6.9</some.version>
</properties>
我的 pom.xml 文件构建插件部分看起来像...
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9</version>
<executions>
<execution>
<id>regex-property</id>
<goals>
<goal>regex-property</goal>
</goals>
<configuration>
<name>some.version</name>
<value>${P_SOME_VERSION_AS_PASSED_BY_JENKINS}</value>
<regex>^dirtyPrefix-(\S*)</regex>
<replacement>$1</replacement>
<failIfNoMatch>false</failIfNoMatch>
</configuration>
</execution>
</executions>
</plugin>
我的 pom.xml 依赖版本看起来像...
<dependencies>
<dependency>
<groupId>someArtifactGroup</groupId>
<artifactId>someArtifact</artifactId>
<version>${some.version}</version>
</dependency>
</dependencies>
这个想法是,如果使用 Jenkins 并传递依赖项覆盖,它将被剥离其前缀并使用而不是默认值。
但是,在验证依赖项之前,此插件似乎不会运行 - 是否可以使其正常工作或有更好的方法?
我处于类似的情况,但是使用 -D 覆盖不是解决方案(只是不要问),而且由于我有一些变量,因此配置文件也没有。
就我而言,它是这样的:fabric8 docker maven 插件使用一个变量。 该变量由“build-helper-maven-plugin”正则表达式属性生成。
如果调用“mvn docker:build”,则不使用验证阶段并且变量不存在(所以我得到一个“${blabla}”文字)并且构建失败。 如果我调用通常的构建,则会创建变量。
我采取了运行“mvn validate docker:build”而不是“mvn docker:build”的策略来强制执行验证步骤,因此创建了变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.