In this video you can start with a project on the Subversion server and import it as a new Java project in Eclipse. This is something you'll do if you want to check out a project from an Internet server, or if you just get started on a new project at work that other people have already been working on.
- [Julian] In this section, we'll start with an existing project on the Subversion server and import it as a new project in Eclipse. This is something you'll want to do if you check out a project from an Internet server or if you get started on a new project at work that other people have already been working on. Start by creating a new workspace in Eclipse. I'll call it SVN project. You can also add this to an existing workspace, but I like to use a separate workspace for each project.
I'll click OK. Maximize the window and switch to the workbench. Now I'll choose the menu option File, New Project. For the project type, scroll down to the SVN section and choose Project from SVN and click Next. Now we can enter the SVN repository URL. This is the URL of the base repository the project is in, not the actual project URL itself.
I can get this more visual SVN server. Back at the management console, I can right-click our repository and choose Copy URL to clipboard. Then I can paste that URL and it points to the repository. I also have to use a username and password to log into the SVN server. So, I'll enter those here. Username is Julian and my password. And I like to save my authentication information so I don't get prompted to log in every time, so I'll check this box too.
I'll click Next. And it will ask me to trust the SSL certificate for the server. I trust the server, so I'll click Trust. Now, we're at a screen that asks us which project to check out. This is the part where we tell Eclipse exactly which folder and revision to work with. If you already know the URL of your project, trunk, or branch, you can just paste or enter it here. If not, you can click the Browse button. This shows you all the folders in the repository. I'll click Browse and I'll find our project.
This will be ProjectDonut and trunk. After selecting trunk, I can click OK. And by default we want to check out the Head Revision. The head revision is just the latest revision in whatever trunk or branch I just chose. If you want to check out an earlier revision, you can enter that here or you can browse for it in a new dialog. For this example, let's just use the latest and greatest version of the project. So, leave Head Revision checked and click Finish. Now Eclipse asks us how we want to check out the project.
This just has to do with how the project appears in Eclipse. It really has nothing to do with the SVN project, file or folders at all. You'll see that these first two options are grayed out. This is because the .project file is one of the files we saved in SVN and that's the file that tells Eclipse what kind of project this is. If the .project file was missing, we'd also have the option to set this up as a Java project, or a J2EE project or whatever. But since Eclipse already knows that this is a Java project, all we can do is change the project name if we want to.
We'll leave that alone. You can choose the depth too. This is pretty much either I want to check out the whole project or I just want to check out some of the top-level folders. There aren't many times where you would want to use an option other than recursive here, which gives you the whole project. Maybe if the project has a huge sub-folder with graphics, you could exclude that, but only if there are no other sub-folders at that same level that you need. Subversion doesn't give you very fine-grained control over that sort of thing. You almost always want to check out the whole project.
We've also got the revision option again. I've no idea why it asked us which revision to use before and then it asks us again. Maybe it just wants to be really sure. Anyway, just select the same revision level as before. In this case, we want the head revision. Click Finish, and then we're done. Back in Package Explorer, we can see the project now has some extra information. It shows the URL of the SVN repository this is connected to and also the revision number of the source folder.
So, now we have a working copy of the SVN project in Eclipse. There's a possibility you'll have to adjust the project's class PATH and JRE settings at this point, depending on your version of Eclipse and what kind of meta information was stored with the project. But, if you need to change anything, Eclipse will usually display an error and let you know. Otherwise, now you can work with a project just like you would work with any other Eclipse project. All the files are local to your machine and you can code normally. The later chapters in this course, we'll talk about how to keep your project in sync with your Subversion server.
- Trunks, tags, and branches
- Checkout, commits, and revisions
- Merging, locking, and working with a team
- TortoiseSVN on Windows
- SVN integration with Eclipse
- Connecting to a project
- Creating a new Java project in Eclipse
- Connecting to an existing Java project using Eclipse
- Dealing with projects that move to a new location
- Making changes and creating branches
- Tracking changes and dealing with conflicts
- Creating a release