I have the below configuration to create a build number and save it in the MANIFEST.MF. The build process generates a buildNumber.properties and keeps track of the last build from it. However this file I assume should be committed back into GIT as a part of storing the buildNumber. Is this understanding correct? or is there any other way to achieve this?
build goal
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