Using SVN in Ant

 IT, Java  Kommentare deaktiviert für Using SVN in Ant
Jun 062014

In my current ant-script I need to get the SVN revision to insert that info into the deployment-package.

There are three commands available.

svn info is the first one:

D:\Projekte\workspace\myCode >svn info
Pfad: .
Basis des Projektarchivs:
UUID des Projektarchivs: hidden
Revision: 12955
Knotentyp: Verzeichnis
Plan: normal
Letzter Autor: pbo
Letzte geänderte Rev: 12859
Letztes Änderungsdatum: 2014-05-21 10:10:14 +0200 (Mi, 21. Mai 2014)

The Revision is the current Revision of the Repository (that means, that if you checkin some changes now, you will get the Revsion 12955+1). The „Letzte geänderte Rev“ (last changed revision) ist the one which was assigned on the last commit/checkin. This is the revision of code that is checked in on the repository. This format is diffiult to handle in ant, that’s the reason why I present another solution:


svnversion without any parameter will display the revsion of the repositry:


„M“ means, that the local code has changed (modified). If you need the latest commited revision, you can append the parameter „-c“:

D:\Projekte\workspace\myCode>svnversion -c

The firs number is the revision that was assigned during first checkin of this project / path. The second number is the revision of the latest commit. There is also a third solution:

svn log

With the svn command with the log parameter you are able to see the commit-messages. With some parameters you can display only the latest commit, including revsion number, date and author:

D:\Projekte\workspace\myCode>svn log -r COMMITTED -q
12859| pbo | 2014-05-21 10:10:14 +0200 (Mi, 21. Mai 2014)

How to use this in ant:

<target name="svnversion">
	<exec executable="svnversion" outputproperty="svnversion" />
	<echo message="SVN Version: ${svnversion}" />

Results in:

Buildfile: D:\Projekte\workspace\myCode\svn.xml
     [echo] SVN Version: 129555M
Total time: 834 milliseconds


<target name="svnLog">
	<exec executable="svn" outputproperty="lastCommittedRevision">
		<arg value="log" />
		<arg value="-r" />
		<arg value="COMMITTED" />
		<arg value="-q" />
	<echo message="lastCommittedRevision = " />
	<echo message="${lastCommittedRevision}" />

Results in:

Buildfile: D:\Projekte\workspace\myCode\svn.xml
     [echo] lastCommittedRevision = 
     [echo] ------------------------------------------------------------------------
     [echo] r12859 | pbo | 2014-05-21 10:10:14 +0200 (Mi, 21. Mai 2014)
     [echo] ------------------------------------------------------------------------
Total time: 1 second


How to install SVN & Eclipse on RedHat 6.3 RHEL 6

 Eclipse, IT, Java, Linux  Kommentare deaktiviert für How to install SVN & Eclipse on RedHat 6.3 RHEL 6
Aug 212012


to install Eclipse do the following steps (based on this tutorial: ):

Download eclipse and extract it to /opt/:

tar -xvzf eclipse-SDK-4.2-linux-gtk-x86_64.tar.gz -C /opt

Make all files readable:

chmod -R +r /opt/eclipse

Create executable in /usr/bin/

touch /usr/bin/eclipse
chmod 755 /usr/bin/eclipse

Notice / Update: I had some issues with Plugins when I not changed the owner of the eclipse folder. You should change the owner to avoid that: (see this link: )

sudo chown -R <user> eclipe

Open that file with your favourite editor and insert that content

export ECLIPSE_HOME="/opt/eclipse"

$ECLIPSE_HOME/eclipse $*

Create a Desktop Launcher:

(right click on Desktop ->Create Launcher)

Now you can start eclipse.

How to Install SVN and SubClipse Plugin:

Install Subversion via Package manager or via yum (needs root):

(use the same command, in this case this package was already installed)

[root@oc3458605084 philboss]# <strong>yum install subversion</strong>
Loaded plugins: repository,
              : refresh-packagekit, security
Setting up Install Process
Package subversion-1.6.11-7.el6.x86_64 already installed and latest version
Nothing to do
[root@oc3458605084 philboss]#



Start Eclipse, click on Help -> Install New Software

and enter this Update Site URL:

Select the features you would like to have and install them.


If you get that error when using Subclipse the first time:



After that I installed the SVNKit also and set the preference to SVNKit:

(Window -> Preferences:)



After restart it worked fine 🙂