Reputation: 31252
Here is the relevant part of pom.xml
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<phase>pre-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>target/swagger/api.json</file>
<regex>false</regex>
<token>$BUILD_NUMBER$</token>
<value>${project.version}</value>
</configuration>
</plugin>
Here is api.json
file
{
"apiVersion": "$BUILD_NUMBER$"
"developers": ["foo", "bar"]
}
After I run, mvn clean package
, I do not see target/swagger/api.json
being updated with project.version
Upvotes: 2
Views: 3677
Reputation: 129
Make sure your plugin declaration is in <build><plugins>
And not in <build><pluginManagement><plugins>
Also, in case your project is part of a bigger maven project, it's safer to use ${project.build.directory} instead of target :
<file>target/swagger/api.json</file>
Upvotes: 1
Reputation: 129
Upvotes: 0