Java – get the current SVN revision in webapp

What is the best way to display / use revisions in Java webapp?

We just use ant to build our War files, no buildserver, etc I hope there are some, if $ref, I can write in a resource file, but this is only updated when the problematic file is submitted I need it all over the world

What would you recommend? Trigger updates some files after commit? Custom ant script? Is there a more non hacker approach? Or better yet, have a version number independent of SVN

Editor: great advice! Thank you very much for your answer!

Solution

There are several ant tasks that can do this for you

Svn ant task on the Tigris River is the oldest

The document is here – in particular, look at the info element, which displays the revision number of the subversion repository as the ant attribute, which is called Rev You can write this value to your resource file using the normal ant substitution mechanism

Someone also added a simple (simpler) task to Google Code Hosting - I've never used it before, so I can't comment

If you already have ant in the build process, these look like the cleanest way

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>