I already have my pom.xml
set up to do some basic replacing on a file during the prepare-package
phase:
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>maven-replacer-plugin</artifactId>
<version>1.3.8</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>target/classes/plugin.yml</file>
<replacements>
<replacement>
<token>maven-version-number</token>
<value>${project.version}-${project.build.number}</value>
</replacement>
</replacements>
</configuration>
</plugin>
However, I'd like to have that value be conditional on whether a particular environment variable is set. I run builds through Jenkins, and so I'd like to check if the environment variable BUILD_NUMBER
is set; if so, it should take the place of project.build.number
.
Is there any convenient way to do that within the replacer plugin? I read over the usage guide, and couldn't find anything immediately useful.