Project

General

Profile

Step 3 - First steps with Z2 on SVN » History » Version 25

Udo Offermann, 13.07.2015 12:58

1 22 Henning Blohm
h1. Step 3 - First steps with Z2 on SVN
2 2 Udo Offermann
3 14 Udo Offermann
Z2 can be used with Subversion just as well as with Git. In fact, the first implementation of Z2 was on Subversion only.
4
5 15 Udo Offermann
The overall approach is the same: The single parts of the z2-environment - such as the core, base, add-ons, application - are stored in separate repositories, and Z2 loads the source code and 3rd party libraries on-demand from SVN using "SVNKit":http://svnkit.com/. In opposite to Git one will usually put the single z2-repositories (we call them _component repositories_, because they are the sources for the z2 components) into one SVN repository installation. Furthermore it is not uncommon that one SVN installation hosts multiple Z2 systems.
6 2 Udo Offermann
7 23 Henning Blohm
See [[Repositories]] for more infos on SVN and Git repository mapping.
8
9 1 Udo Offermann
h2. Prerequisites
10 2 Udo Offermann
11 23 Henning Blohm
You need a properly setup JDK 6 or higher on Linux, Mac OS X, or Windows.
12 1 Udo Offermann
13 4 Udo Offermann
This how-to uses the "SVN":http://subversion.apache.org/ VCS (we're using SVN version 1.6 and 1.7). You can also run Z2 together with Git as described on [[Step 2 - Install and run in 5 minutes]] and [[Step 3 - First steps with Z2 on Git]].
14 1 Udo Offermann
15 4 Udo Offermann
For Eclipse-SVN integration we are using "Subclipse":http://subclipse.tigris.org/, which is also supported by the Z2 Eclipsoid plug-in. You can also use "Subversive":http://www.eclipse.org/subversive/ however there is no Eclipsoid-Subversive integration so far.
16
17 24 Udo Offermann
h3. Svnkit not longer part of z2 v2.3
18
19
Z2 version 2.3 does not longer contain svnkit out of the box. In order to use z2 with svn one has to enrich the z2 classpath either with the svnkit or javahl libraries.
20
21
h4. Using z2 with javahl
22
23
Install javahl on your system (for example from wandisco: http://www.wandisco.com/subversion/download). Assuming javahl is installed at /opt/subversion you can start z2 by
24
<pre>
25
z2-base.core/run/bin/go.sh -cp z.jar:/opt/subversion/lib/svn-javahl/*
26
</pre>
27
28 25 Udo Offermann
Please make sure that the z2 kernel jar "z.jar" is defined on the classpath too!
29 24 Udo Offermann
30
h4. Using z2 with svnkit
31
32
Download svnkit from http://svnkit.com/download.php and store it to some path @$svnkit@ on your system. Now you can start z2 by
33
<pre>
34
z2-base.core/run/bin/go.sh -cp z.jar:$svnkit/lib/*
35
</pre>
36
37 25 Udo Offermann
Please make sure that the z2 kernel jar "z.jar" is defined on the classpath too!
38 24 Udo Offermann
39 4 Udo Offermann
h2. Creating a home for Z2
40
41
The folder layout is a bit simpler with SVN because SVN workspace and Eclipse workspace can overlap. 
42
43
Create a folder called z2-base inside your favorite/home/development/what-ever directory and enter it. This will be the home for our Z2 installation and the Eclipse workspace:
44
45
<pre>
46 19 Henning Blohm
mkdir z2-base
47
cd z2-base
48 4 Udo Offermann
</pre>
49
50 19 Henning Blohm
h2. Getting the Z2 core
51 1 Udo Offermann
52 20 Henning Blohm
Start Eclipse and choose z2-base as workspace. Go to the SVN repository perspective and add a new repository location http://www.z2-environment.net/svn/z2-environment/trunk/z2-base.core. Use user name "z2-environment" and the same password, when asked.
53
54 23 Henning Blohm
Right-click the new entry and choose "Checkout..." and simply click "finish" on the first "Checkout from SVN" wizard page. The core will be downloaded into your Eclipse workspace and opened as project "core" (or "z2-base.core")
55 4 Udo Offermann
56
Switch back to the Java perspective and dive into the core project. You will see two _"z2_base*.launch"_ files - right-click the one that matches your OS and choose "Run As >" / "z2_base".
57
The Z2 server will be started inside a new window showing some log messages where the last one should be "... Completed worker process initialization".
58
59 1 Udo Offermann
{{include(how to install eclipsoid)}}
60 6 Udo Offermann
61 1 Udo Offermann
h2. Changing source code and check the result
62
63 23 Henning Blohm
To check out the calculator sample project we will be working on, add the repository destination http://www.z2-environment.net/svn/z2-environment/trunk/z2-base.base to your SVN setup.
64 4 Udo Offermann
65 23 Henning Blohm
Once you've installed the Eclipsoid plug-in and assuming you use Subclipse you can alternatively use the "z2-Repositories View" to add repositories currently in use by your local Z2 runtime:
66
67 17 Udo Offermann
!z2-repositories_view_svn.png!
68
69 1 Udo Offermann
70 23 Henning Blohm
Import the calculator project into your Eclipse workspace: Either from the Subversion perspective or from the "z2-Repositories" view
71 8 Udo Offermann
72 17 Udo Offermann
From here on there is no Z2 specific difference any more between development with SVN or Git. As described at [[Step 3 - First steps with Z2 on Git#Changing source code and check the result]] you resolve the classpath for z2-projects via <Alt+R> and the error markers should be gone. You arm projects via "Arm z2-Projects" in the project's context menu, so that your local version in the workspace will be taken with preference over the calculator project in the SVN repository. Now you can perform the roundtrip: 1) change code, 2) sync server (by pressing Alt+Y> and 3) check results in your "browser":http://localhost:8080/helloworld/ several times.
73 21 Henning Blohm
74
Continue with [[Z2_Modules_intro]]