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: .
URL: https://svn.xxx.xx/abc/def/
Basis des Projektarchivs: https://svn.svn.xxx.xx/abc/def/
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

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

D:\Projekte\workspace\myCode>svnversion
12955M

„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
11789:12859M

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}" />
</target>

Results in:

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

 

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

Results in:

Buildfile: D:\Projekte\workspace\myCode\svn.xml
svnLog:
     [echo] lastCommittedRevision = 
     [echo] ------------------------------------------------------------------------
     [echo] r12859 | pbo | 2014-05-21 10:10:14 +0200 (Mi, 21. Mai 2014)
     [echo] ------------------------------------------------------------------------
BUILD SUCCESSFUL
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
 

Hi,

to install Eclipse do the following steps (based on this tutorial: http://www.if-not-true-then-false.com/2010/linux-install-eclipse-on-fedora-centos-red-hat-rhel/ ):

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: https://philipp-boss.de/it/linux/eclipse-updates-or-plugins-are-not-working-linx )

sudo chown -R <user> eclipe

Open that file with your favourite editor and insert that content

#!/bin/sh
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]#

 

Subclipse

Start Eclipse, click on Help -> Install New Software

and enter this Update Site URL: http://subclipse.tigris.org/update_1.8.x

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 🙂