我有以下配置来创建内部版本号并将其保存在 MANIFEST.MF 中。构建过程会生成一个 buildNumber.properties 并跟踪它的最后构建。但是,我认为这个文件应该作为存储 buildNumber 的一部分提交回 GIT。这种理解正确吗?还是有其他方法可以实现这一目标?
建立目标
mvn clean package
pom.xml
<scm>
<connection>scm:git:https://abc.xyz.com/#projects/scm/DOCKER-AbcServer.git</connection>
</scm>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<format>{0,number}</format>
<items>
<item>buildNumber0</item>
</items>
<doCheck>true</doCheck>
<doUpdate>true</doUpdate>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Build-Number>${project.version}-r${buildNumber}</Build-Number>
<Build-SCMBranch>${scmBranch}</Build-SCMBranch>
<Build-Time>${maven.build.timestamp}</Build-Time>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
buildNumber.properties
#maven.buildNumber.plugin properties file
#Fri Aug 10 10:49:49 PDT 2018
buildNumber0=2