我有一个使用buildnumber-maven-plugin
. 如果我运行,mvn validate
我会看到它正在工作:
[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
但是,如果我运行mvn resources:resources
过滤后的文件并不会拾取它:
[INFO] --- maven-resources-plugin:2.6:resources (default-cli) @ myproject ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
有pom.xml
:
<build>
...
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>version.txt</include>
</includes>
</resource>
version.txt
拥有:
${buildNumber}
但是在maven运行之后,没有过滤:
> cat target/classes/version.txt
${buildNumber}
内部版本号配置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>
我对马文的了解还不够。运行资源“目标”不应该也获得buildNumber
财产吗?