Java Programming for team using Eclipse and SVN
The document is based on:
Eclipse 4.6, 4.7 (NEON, OXYGEN)
Maybe you are interested:
- TODO Link!
This is a working model for Java team using Eclipse and SVN:
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:
- TODO Link!
Next, Subversive must be installed on each Eclipse program of each member. You can see the instruction at:
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 of the SVN Repository.
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:
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).
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.
SVN has many functions illustrated as the below image:
We will learn about how to use some important functions.
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.
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:
- 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.
- 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...