Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Nigel Wade Newsgroups: comp.lang.java.programmer Subject: Re: Get Rev Number from SVN to Display in Web App Date: Tue, 08 May 2012 14:56:10 +0100 Lines: 62 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Trace: individual.net Fvw5lqZkQDUHrWzLCnYDoQRoUTVJaKGiaSzLgq8roLPMoA+pzX+zyTWPf5FDmGFEYy Cancel-Lock: sha1:Fnr009/i4KdzGd4CuzbZEjbfvNU= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:14407 On 08/05/12 11:15, Jan Burse wrote: > Dear All, > > Is there a simple Ant task to retrieve the revision > number of my code from a SVN repository, and then > store it in some location, so that later my web > application can show it? > > Best Regards I use NetBeans, and have added the following to its build.xml for an application in which I want to include the SVN revision. This sets a property for ant: SVN version ${svna.version} This embeds it into the jar manifest in the post-jar target: ... This is the resulting contents of the jar manifest: Manifest-Version: 1.0 Main-Class: package.Main Implementation-Version: 384M SVN-Revision: 384M The main class extracts it, when given the -v flag, using: System.out.println("SVN revision : " +Main.class.getPackage().getImplementationVersion() ); HTH. -- Nigel Wade