Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Eclipse and Subversion: Project Source Control From Within the IDE

Learn everything you need to know about integrated source control with Eclipse and Subversion. You'll be able to seamlessly manage source code and other shared files in your software projects.


advertisement

Generally, developers don't use source control from within their IDEs or put off integrating their own code with the project source control because they believe that doing otherwise is easier and faster. This misconception -- like most misconceptions -- is quickly dispelled with a little better understanding.

In this tutorial, I aim to provide that understanding for reluctant developers by walking through integrated source control with Eclipse and Subversion (SVN). While the focus will be on this specific IDE and Source Control combination, both tools are standard and the concepts will be common to most environments you may work in. If you work with Java and/or J2EE, most of the popular tools are extensions of the Eclipse and Subversion combination.

Installing the Eclipse SVN Plugin

If you've never installed an Eclipse plugin, the standard process is very straight forward, despite the circular and confusing FAQ entries at Eclipsepedia. I found a very detailed set of instructions at an NCSU URL, and the update site for Subversion (my preferred SVN plugin, there are others) is helpful. While Subversive is an official Eclipse project, you will need to go to the project sponsor's site for additional download locations and installation options.



Assuming you have gone the recommended installation route of using Eclipse Update Manager, most users will need to select only one of the offered installations from the Subversive install site, which is currently the last option, Subversive SVN Team Provider Plugin:


Eclipse SVN: For Most Installations Check Only Subversive SVN Team Provider Plugin
Click here for larger image

Figure 1. For Most Installations Check Only Subversive SVN Team Provider Plugin

If you have a 64-bit version of Windows, you also should select the Subversive Client Libraries. If you aren't certain if you need it, you can always install it later. Some people are tempted to simply select all of the installations, but some of the options could conflict with other plugin libraries, so unless you actually need the other options, don't select them. Once you have made your selections, follow the usual acceptance of license and ignore any warnings about unsigned content.

Select the Restart Now option when it is all over with, and afterwards you will have some new perspectives to use. I strongly suggest leaving the SVN Repository Exploring perspective always open. For new users it acts as a reminder to keep in synch with the project, and for advanced users it saves a few clicks when you want to managed your repository.


Eclipse SVN: New SVN Perspective in Eclipse
Click here for larger image

Figure 2. New SVN Perspective in Eclipse

Connecting to an Existing Source Repository

Most developers will be connecting to an existing project the first time they use SVN. Many new users create their connection at the root of the repository and then become overwhelmed with the full directory structure. For new users I recommend connecting to a single project or group of projects. With SVN, locations are URLs, so if someone gives you only the root URL, you can go to a browser and drill down to the URL you want.


Eclipse SVN: Use the Repository URL to Drill Down to Project URLs
Click here for larger image

Figure 3. Use the Repository URL to Drill Down to Project URLs

You can now use the more direct URL to connect to your repository. The following screens will walk you through the process.


Eclipse SVN: Click the Icon with the Green +
Click here for larger image

Figure 4. Use the Repository URL to Drill Down to Project URLs


Eclipse SVN: A Custom Label is Easier to Remember Later
Click here for larger image

Figure 5. A Custom Label is Easier to Remember Later

Recall that some 64-bit Windows installations require the client libraries. If you receive the following error at this point, you will know that for certain:


Eclipse SVN: 64-Bit Windows Requires Client Install
Click here for larger image

Figure 6. 64-Bit Windows Requires Client Install

Even if you selected the Subversive Client Libraries during installation, you still need to configure the client per workspace in the Eclipse Options:


Eclipse SVN: Configure the SVN Client if Necessary
Click here for larger image

Figure 7. Configure the SVN Client if Necessary

Once connected, you will be able to browse the repository from the point of the URL you entered when creating the connection.


Eclipse SVN: Configure the SVN Client if Necessary
Click here for larger image

Figure 8. Repository from Root of URL Configured

While the Subversive plugin facilitates creating properly formatted Eclipse projects, it does not enforce it. We will look at how to add the project correctly so that it integrates easily with Eclipse, and proceed with the Pollyanna assumption that all projects will be properly formatted. To add the project to your Eclipse workspace, right-click and select Find/Check Out As.


Eclipse SVN: Use Find/Check Out As… Option for Eclipse Projects
Click here for larger image

Figure 9. Use 'Find/Check Out As…' Option for Eclipse Projects


Eclipse SVN: Check Out as a Project
Click here for larger image

Figure 10. Check Out as a Project


Eclipse SVN: An Integrated Team Project
Click here for larger image

Figure 11. An Integrated Team Project

In some cases, projects are grouped in SVN. If your repository projects are grouped, you can start the process one step higher on the tree (MyImportantProjects, as illustrated in Figure 9: Use Find/Check Out As… Option for Eclipse Projects). The plugin then will find the projects for you, if asked.


Eclipse SVN: Subversive Will Find Projects For You in Groups
Click here for larger image

Figure 12. Subversive Will Find Projects For You in Groups


Eclipse SVN: Confirm the Projects to Complete the Checkout
Click here for larger image

Figure 13. Confirm the Projects to Complete the Checkout

Projects and files under source control will indicate their current state with icons. These icons are very intuitive, such as a database image to indicate under source control, a question mark to indicate an object in a managed project is not managed, the ">" symbol to an object with changes locally. A list of the icons, their meaning, and how to manage them (for advanced use) can be found at here.

A Couple of Notes about File Commit Before We Continue

We will look at these two sub-topics before we go further so they will not become a distraction later.

  1. Some Eclipse packages have missing or conflicting UI libraries that cause the following error message when checking files in:


    Eclipse SVN: Ignore This Annoying Error
    Click here for larger image

    Figure 14. Ignore This Annoying Error

  2. When you commit files you will be promoted to make a comment. You should. It may never matter if you don't, but the one time it does matter, you can't go back.


Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap