I've got a maven project that uses the buildnumber-maven-plugin
. If I run mvn validate
I see it's working:
[INFO] --- buildnumber-maven-plugin:1.3:create (default) @ myproject ---
[INFO] Executing: /bin/sh -c cd /Users/rob/Workspace/myproject && git rev-parse --verify HEAD
[INFO] Storing buildNumber: 5d315d8d1a43c3289fbf114c379fa1a3d3787044 at timestamp: 1477059166424
But if I run mvn resources:resources
the filtered file does not pick it up:
[INFO] --- maven-resources-plugin:2.6:resources (default-cli) @ myproject ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
The pom.xml
has:
<build>
...
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>version.txt</include>
</includes>
</resource>
version.txt
has:
${buildNumber}
But after maven runs, no filtering:
> cat target/classes/version.txt
${buildNumber}
The build number config in pom.xml
:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>validate</phase>
<goals><goal>create</goal></goals>
</execution>
I don't know enough Maven. Shouldn't running the resources "goal" also get the buildNumber
property?