This Step By Step Tutorial Explains How to Integrate SVN with Eclipse. This Integration Helps Developers To Keep The Code Updated and Share With Team Members:
In this Eclipse Training Tutorials for Beginners, we learned about Configuration of Maven with Eclipse Java IDE.
So far we have seen how Eclipse is integrated with Maven. Now if you have a fully functioning code then you will need version control for it. SVN is one of the tools for version control and several other features. Integrating this tool in Eclipse makes it easier for developers to keep their code up-to-date and helps them share it with teammates.
What You Will Learn:
What Is SVN?
SVN or Subversion is a software versioning tool. Versioning means maintaining a history of the code that you are writing. This is very important in today’s age as multiple people are working on the same projects from various locations.
To ensure that everyone has updated code, their changes can be merged using SVN. SVN must be installed on a central server in case of official projects. Apart from this, to use SVN properly you must integrate it with your Eclipse IDE. You must integrate SVN plugin and connectors. The plugin cannot function without the connectors.
Steps to Configure SVN with Eclipse
#1) First, you need to install the SVN plugin in the Eclipse IDE. To do this go to the top menu on Eclipse and select Help -> Install New Software.
The following window will open up, click on the Add button.
By clicking on the add button in the dialogue box that appears, add name and location depending on the version of SVN you want to install as shown below.
Click Add and the Eclipse starts fetching SVN information and you will see a progress bar as shown below.
Let it finish processing.
#2) Once Eclipse is done with fetching information, it will show all the SVN features available for installation. Some of these features are optional whereas some are not.
You can choose to install all, or leave the optional features:
Select the features that you want and click next. Again Eclipse will fetch all features and dependencies for installation.
You can see the versions of SVN and this will be compatible with your Eclipse Version. Ensure that the SVN you install on your machine is also compatible with this configuration.
#3) As soon as Eclipse is done with fetching all the required details, a list of all the features being installed will be displayed.
Click on next.
#4) You will be asked to accept the license agreement on the next page.
Click on the radio button to accept the terms and click on finish.
SVN will start installing and you will see the progress bar on the bottom of the Eclipse.
Once Eclipse is done installing, it will ask you to restart the Eclipse IDE:
Click on Restart Now.
#5) Once the plugin is installed, the next step is to install the SVN connector. You can install one or more connectors in Eclipse. As soon as the Eclipse restarts after the SVN plugin installation, it displays SVN information on the welcome page.
Close the welcome page and navigate from the top menu to Window -> Preferences, the following window will open.
In this window, navigate to Team -> SVN, and open the SVN connectors Tab in the resulting page. On this page, you will see a get connector’s button. Click on it.
#6) Eclipse will display all the connectors that are compatible with your Eclipse as shown below.
Select the connector of your choice and click on the finish. It will again take some time to configure the connector.
#7) Once Eclipse finishes you will be displayed with the features being installed, you can select all or leave the optional features.
Click on next.
#8) Eclipse will ask you to accept the license agreement, accept it and click on finish.
While installing Eclipse, it may show you some alerts, accept them and let it complete the installation.
Once the installation is done, again Eclipse will ask you to restart. After the restart, if you check preferences again, you will see the installed connector to be present there.
At this point SVN configuration with Eclipse is complete.
Committing a Project to SVN
To commit a complete project to SVN trunk branch, you can do the following:
#1) Right-click on the project folder in the project explorer, and click on Team -> Share.
#2) In the following window, select SVN and click next.
#3) The next window will ask you for your SVN repository URL and credentials, enter that and click finish to add and commit.
Enter your SVN repository URL and credentials and click on next. Click ok for any prompts that Eclipse may give you.
Eclipse will start adding your project to the given repository.
#4) Once the configuration is done, the following window will be displayed, click on next.
On the next page, your project details will be displayed, click on Finish.
Your project will get added to the SVN repository.
Once you have your project in SVN or if you have imported any other project from your repository, all the functions available in SVN are available through Eclipse.
To view these functions, all you have to do is right-click on the project folder in the project explorer and navigate to Team.
As you can see, all the features of SVN are available through Eclipse like commit, merge, view revision history, lock, and many more.
Similar to SVN, another famous version control tool is GIT. GIT is usually pre-configured with newer versions of Eclipse. All that you need is to pass your repository information by going to Windows -> Preferences -> Team -> GIT. After that, you can use GIT in a similar fashion as SVN.
In this tutorial we have learned about integrating SVN with Eclipse, this will help you and your team to keep your code updated and share with others.
In the next tutorial will learn how to get and use TestNG in the Eclipse Java IDE.