How to display SVN version in Maven usng the build-number plugin

三世轮回 提交于 2019-12-01 08:02:10

As the documentation says, if you use the special <item> buildNumber, it does not use the SVN Revision, but instead creates/reads a special property file.

If you do want to use the SVN revision, you need to follow the configuration specified in the first exmaple in the usage page. The other examples are meant to illustrate usages which does not make use of SVN revision, but a local build number (as in case of continuous integration builds).

Snekse

Update to version 1.2 of buildnumber-maven-plugin and use scmVersion.

<items>
    <item>timestamp</item>
    <item>scmVersion</item>
</items>

Helped greatly by this SO response.

I ended up using buildnumber-maven-plugin without format parameter to get svn revision, and date using:

<properties>
    <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>
    <build.date>${maven.build.timestamp}</build.date>
</properties>

then, in filtered resource:

r${buildNumber}, ${build.date}

Does this matter?

"The buildNumber plugin will then update your local repository. This is done because 'svn info' grabs the revision out of your local repository, and is not necessarily the same as the revision in the remote repository. You should probably deal with these changes before creating a build in any case. Again, this behaviour can be suppressed with -Dmaven.buildNumber.doUpdate=false."

http://mojo.codehaus.org/buildnumber-maven-plugin/usage.html

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