Java Programming for team using Eclipse and SVN

  1. Introduction
  2. The installation requires
  3. Share Project to SVN Repository
  4. Checkout Project from SVN Repository
  5. Commit and Update
  6. The basic functions

1. Introduction

The document is based on:
  • Eclipse 4.6, 4.7 (NEON, OXYGEN)

Maybe you are interested:
  • Use Eclipse to Clone a GitHub Repository with multiple projects

2. The installation requires

This is a working model for Java team using Eclipse and SVN:
VisualSVN Server
To get SVN Repository, you need to install a SVN Server like Visual SVN on some computer, and it will be a SVN server. You can see the instruction of installing and configuring Visual SVN at:
  • Use SVN Repository for free XP-Dev
Next, Subversive must be installed on each Eclipse program of each member. You can see the instruction at:

3. Share Project to SVN Repository

First, a member needs to share the code of the initial project on SVN Repository.
The below image illustrates 3 projects available on a computer of a member. We will share these three projects on SVN Server.
On Visual SVN, a Repository named as JavaProjects has been created.
Copy URL:
Copy URL of the SVN Repository.
  • https://TRAN-VMWARE/svn/JavaProjects/
You can change the name server by IP address.
Back to Eclipse.
We will share 2 Project: ProjectController & ProjectModel into Repository JavaProjects:
Project 2: ProjectController & ProjectModel has been shared on SVN Repository.
Whenever you want to continue to share other Projects on the same available Repository (For example, JavaProjects), we will go on sharing ProjectView Project on SVN Repository JavaProjects
Project ProjectView shared on Repository.
See in Visual SVN Server:

4. Checkout Project from SVN Repository

Other members in the group will checkout Projects from Repository to our own computer.
Suppose that we only checkout 2 Project, other Project will checkout laster.
2 Project was checkout.
We continue to checkout other Projects (For example, it has just been shared by someone in the group).

5. Commit and Update

Checkout is to extract the whole of data from one or more Projects shared in Repository to the local computer (When the local computer does not have that Project). Then the data are modified in the local computer. Use the Commit function to bring the modified data to Repository. And use the Update function to extract the modified data.
Now we modify (or add) files on Projects, and Commit them to Repository.
To bring modified data to SVN Repository, right-click on Project or select the modified file, click Team/Commit.
Data were Commited to SVN Repository.
In Eclipse of the other members, can use the Update function to update the changes
Note: In some case, when Commit is notified with error, you need to Update before Commit.

6. The basic functions

SVN has many functions illustrated as the below image:
We will learn about how to use some important functions.
Add to svn:ignore
When you want SVN to ignore and not to bring a folder or a file to SVN Repository, you can use the function: Add to svn:ignore
For example, you have a folder containing data files you don't want to share as the below illustrated image:
Right-click the folder mynote, select Team/Add to svn:ignore
If Commit failed as shown below:
In this case you need to update the project before Commit.
Revert is used to return the initial data. For example, when you modify data of some files, revert helps return the file to its initial state.
Lock & Unlock
You are modifying some files in local. During the modification, if you don't want anyone in the group to Commit data of these files to Repository, you can use the Lock function to lock it. After the modification is finished, you can Commit and use the Unlock function to unlock the file.
You modify some files and Commit to SVN Repository, but you will receive a notice of error if one of these files is being locked by someone. Cleanup helps free from forced lock. You cannot use the Unlock function in this case since it can be used by the person who locks file.
Your project is connected to the SVN Repository.
When looking at Project folder on hard disk, you will see that each folder contains a .svn hidden folder. These folders contain state information and data of files of SVN (It is alike a local repository).
Right-click on a Project and select Team/Disconnect to disconnect with SVN Repository.
There are two choices for the Disconnection:
  1. Disconnect parallel to delete SVN meta-information
    • This selection means to erase .svn hidden folders in all folders of Project. This situation does not allow to reconnect, except for erasing Project on hard disk and checking out again.
  2. Or only disconnect.
    • This selection simply means to disconnect. SVN meta-information is still retained.
Here I illustrate the use of option 2:
You can reconnect, right-click on the selected Project, select: Team/Share Project...

Java Basic

Show More