I\'ve a Java project using Spring Framework and Git and I wanted to display a build number. I found the Build Number Maven plugin. With Git the build number is a Git hash. I
I could not reproduce the problem reported by the OP. In my case both command line and m2eclipse work fine and the file is generated correctly in the target/classes folder. The answer provided by @KasunBG is incorrect. The buildNumber.properties is generated only if you use the following:
<format>{0,number}</format>
<items>
<item>buildNumber</item>
</items>
buildNumber.properties is used to store a number which can be incremented. For this reason ( I think ) the plugin doesn't generate this file if you use timestamp/scmVersion etc.
The documentation page says that the properties files is stored at ${basedir}/buildNumber.properties
, which is created when the buildnumber:create
phase is ran.
Store it in a filtered properties file. See Using maven to output the version number to a text file
You shouldn't set revisionOnScmFailure
option to true
, it doesn't expect a boolean. Set it to revision string you want to use when SCM is unavailable, like na
or like that. It doesn't matter for your case since you override the build number format but it would be more correct.
See buildnumber-maven-plugin docs.