Project

General

Profile

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

Udo Offermann, 13.09.2012 15:50

1 1 Udo Offermann
h1. Step 4 - 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
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, 
6
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 
7
(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.
8 2 Udo Offermann
9
h2. Prerequisites
10
11
You need a properly setup JDK 6 on Linux, Mac OS X or Windows - that's all.
12 1 Udo Offermann
A halfway modern system will do.
13
14 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]].
15 1 Udo Offermann
16 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.
17
18
h2. Creating a home for Z2
19
20
The folder layout is a bit simpler with SVN because SVN workspace and Eclipse workspace can overlap. 
21
22
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:
23
24
<pre>
25
:dev$ mkdir z2-base
26
:dev$ cd z2-base
27
</pre>
28
29
h2. Cloning the Z2 core
30
31
Start Eclipse and choose z2-base as workspace. Go to the SVN repository perspective and add a new repository location "svn://z2-environment.net/z2-master/trunk/z2-base.core".
32 11 Udo Offermann
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".
33 4 Udo Offermann
34
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".
35
The Z2 server will be started inside a new window showing some log messages where the last one should be "... Completed worker process initialization".
36
37 6 Udo Offermann
h2. Installing the Eclipsoid plug-in
38
39 12 Udo Offermann
The installation of the Eclipsoid plug-in is described at [[Step 3 - First steps with Z2 on Git#Installation-of-the-Eclipsoid-plug-in]]. 
40 6 Udo Offermann
41
h2. Changing source code and check the result
42
43 7 Udo Offermann
Once you've installed the Eclipsoid plug-in go to "z2-environment" in the Eclipse menu and choose "z2-Repositories View" - a new view should open inside the lower views-tab:
44 4 Udo Offermann
45
!z2-repositories_view_svn.png!
46 5 Udo Offermann
47 13 Udo Offermann
Right-click "environment/samplesRepository" and choose "Add SVN repository" - this will only work if you installed the Subclipse plug-in. (For Subversive you can copy the SVN URL from the repository properties: look for the property called "svncr.url" inside the "z2-Repositories" view or inside the general Eclipse properties view when the entry "environment/samplesRepository" is selected. Now you can right-click the property and copy the value to the clipboard. Add this SVN URL to your Subversive repositories list).
48 6 Udo Offermann
49 1 Udo Offermann
Import the Hello World project into your Eclipse workspace. When using Subclipse you can open the "z2-Projects" node inside the "z2-Repositories" view, right-click "com.zfabrik.samples.helloworld" and choose "SVN checkout", when using Subversive you have to do this via the Subversive perspective.
50 8 Udo Offermann
51 10 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 the project 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 "Hello World" 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.