Maven build number plugin, how to save the build number in a file?

夙愿已清 提交于 2019-12-02 18:14:35
Michael-O

Store it in a filtered properties file. See Using maven to output the version number to a text file

Tvaroh

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.

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.

Kasun Gajasinghe

The documentation page says that the properties files is stored at ${basedir}/buildNumber.properties, which is created when the buildnumber:create phase is ran.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!