Integrating with Eclipse: The Subclipse Plug-in

A good SCM should be closely integrated into your working environment. No one really likes having to go to the command line to add files to the repository. Eclipse has had excellent CVS integration for a long time, but until recently Subversion users have been left out in the cold. Now the new Subclipse plug-in provides a smooth integration of Subversion in Eclipse.

Installing the Subclipse Plug-in

You install Subclipse from the update site in the usual way:

  1. Open the Find and Install window (Help > Software Updates > Find and Install).
  2. Select the "Search for new features to install" option and click Next.
  3. Click New Remote Site and create a remote site with the name Subclipse and the URL http://subclipse.tigris.org/update_1.0.x (see Figure 1).
  4. In the resulting Install window, check Subeclipse in the Features to Install list, and step through the wizard to install the plug-in.
  5. When you’re done, restart Eclipse. Now you’re ready to go!

Figure 1 Installing the Subclipse plug-in.

 

Setting Up Repository Definitions

Now that you have the plug-in installed, you need to tell it where your project repositories are. You do this in the SVN Repository view. Open this view (Windows > Show View > Other > SVN Repository) and select New > Repository Location in the contextual menu to display the dialog box shown in Figure 2. Enter the appropriate URL and click Finish.

 

Figure 2 Adding a repository definition.

 

 

Checking Out a Project

Once the repository is set up, you can browse through its contents in the SVN Repository view (see Figure 3). As we’ll see later, this view is a handy way to interact with Subversion.

 

 

Now let’s check out a project into your Eclipse workspace. Just select the Subversion repository you need (typically it will be trunk), open the contextual menu, and select Checkout. This will open a wizard with two options:

  • Check out as a project configured using the New Project Wizard. This option opens the New Project Wizard, which lets you configure the project using one of the built-in Eclipse project types. This option is generally the best, as it lets you use the same project templates and configuration screens that you use when creating a conventional project.
  • Check out as a project in the workspace. This option simply creates a vanilla Eclipse project in your workspace containing the checked-out source code.

In both cases, you still need to update the project build path, because Eclipse can’t work out where the Java source code is before checking out the project source code.

Importing a New Project into the Repository

If you’ve just started a new project, you need to import it into the Subversion repository. Subclipse provides a convenient way to do this directly from within your IDE. Select your project in the Package Explorer view and select Team > Share Project in the contextual menu. You can use one of the existing repositories, or create a new repository definition. After you’ve specified the repository and the project name, you can specify the files and directories you want to place in the repository and provide an initial comment (see Figure 4). This approach is particularly useful because it lets you selectively import only the files that should be managed with Subversion, even if the project contains other files such as generated classes, temporary files, or other unnecessary artifacts.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值