您的位置:首页 > 编程语言 > Java开发

Eclipse中SVN版本控制插件的安装和使用

2009-03-13 16:38 826 查看
一、SVN服务端(svn-1.4.3-setup.exe)
http://subversion.tigris.org/project_packages.html
{
1. 软件下载
Subversion服务器可以到官方网站下载,也可以直接点击下载svn-1.4.0-setup.exe 。
TortoiseSVN是在window环境下使用的Subversion客户端,可以看作Windows资源管理器的插件,安装之后Windows就可以识别Subversion的工作目录。 官方网站是TortoiseSVN ,下载方式和前面的svn服务器类似,在Download页面的我们可以选择下载的版本,目前的最高稳定版本的安装文件为TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.msi。

2. 软件安装

服务器安装,直接运行svn-1.4.0-setup.exe ,根据提示安装即可,这样我们就有了一套服务器可以运行的环境。安装TortoiseSVN,同样直接运行TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.msi按照提示安装即可,不过最后完成后会提示是否重启,其实重启只是使svn工作拷贝在windows中的特殊样式生效,与所有的实际功能无关,这里为了立刻看到好的效果,还是重新启动机器。

3. 建立版本库

运行Subversion服务器需要首先要建立一个版本库(Repository),可以看作服务器上存放数据的数据库,
我 们可以使用TortoiseSVN图形化的完成这一步: 在目录E:subversionrepository下"右键->TortoiseSVN->Create Repository here...“, 然后可以选择版本库模式, 使用默认即可, 然后就创建了一系列目录和文件。

4. 配置用户和权限

来到E:subversionrepositoryconf目录,修改svnserve.conf:
# [general]
# password-db = passwd
改为:
[general]
password-db = passwd 然后修改同目录的passwd文件,去掉下面三行的注释:
# [users]
# harry = harryssecret
# sally = sallyssecret
最后变成:
[users]
harry = harryssecret
sally = sallyssecret

注意:去掉#号后,要使当前行顶格,不要留在行头留出空格来;否则,会在创建版本数据库时出错

5. 运行独立服务器

进入命令提示符,输入svnserve -d -r E:subversionrepository,我们的服务器程序就已经启动了。

注意:不要关闭命令行窗口,关闭窗口也会把svnserve停止。

6A. 建立trunk目录

在地址栏输入svn://localhost/后回车,则会弹出‘Repository Browser' 对话框

可以在对话框中创建新的目录trunk,然后添加源代码(添加源代码这个动作也可以在6B中实现,更为方便)。

6B. 添加源工程文件

来到我们想要导入的项目根目录,本例中是E:subversionprojects,目录下有两个需要导入的工程文件夹:在空白处 右键->TortoiseSVN->Import... , 在弹出对话框的URL of repository框中输入“svn://localhost/” , 然后确认。完成之后目录没有任何变化,导入过程中会在在弹出的对话框中显示导入文件的信息,这样就可以将当前目录下的所有文件都导入到我们刚定义的版本库中。
需要注意的是,这一步操作可以完全在另一台安装了TortoiseSVN的主机上进行。例如运行svnserve的主机的IP是133.96.121.22,则URL部分输入的内容就是“svn://133.96.121.22/”。

至此,SVN 服务器端配置完毕,你也可以点击此处观看动画教程 下面便可以凭借Eclipse下的svn客户端插件来对源工程进行同步开发。
} //这个是第一种情况
二、把SVN设置成window服务(SVNService.exe)
我没有下载地址,如有需要,留下你的email
三、Eclipse的SVN插件(用Eclipse插件下载):
Eclipse中SVN版本控制插件的安装和使用
2009-01-07 21:07

以前提到过SVN版本控制器和客户端的安装和配置,这里再在说一下在编译器中怎么使用SVN,使其既可以单独使用,也可以配合SVN客户端一起使用。由于编译器种类众多,插件种类也不同,这里只简单介绍下Eclipse的插件安装。我用的版本是Eclipse3.2.2+MyEclipse_5.1.1,由于本身只有CVS而没有集成SVN,所以要想使用SVN做版本控制只好装一个Eclipse插件Subclipse,Subclipse的详细安装过程在其官方网站 http://subversion.tigris.org写的很清楚,还带配图,我就直接copy了:

一、Install Subclipse in Eclipse 3.x(安装)
Step 1:
Begin the installation from the Eclipse Help menu item.

Step 2:
This screenshot show the screen as it initially comes up. In this case you will need to change the radio button to indicate that this is a new install.

Step 3:
This screen will vary depending on the features you have installed already. You want to click on the New Remote Site button. If you are behind a proxy and the Eclipse install mechanism does not work, then you can download a zipped version of the update site and then click the New Local Site button instead.

Step 4:
This screen is showing the New Remote Site dialog, filled in with the correct information to install Subclipse

Name: Subclipse 1.2.x (Eclipse 3.2+)
URL: http://subclipse.tigris.org/update_1.2.x
Name: Subclipse 1.0.x (Eclipse 3.0/3.1)
URL: http://subclipse.tigris.org/update_1.0.x
Step 5:
When you first come back to this screen, the site you added will NOT be selected. Be sure to select it before clicking Next.

Step 6:
This next screen shows all of the features that are available to install.

Step 7:
Click the button to accept the license agreement.

Step 8:
Confirm the install location

Step 9:
There is an Eclipse preference to turn off this next dialog. I have never seen a signed feature. Not even Eclipse.org nor IBM sign their features.

Step 10:
Just a screenshot of the in-process installation.

Step 11:
Eclipse needs to be restarted after installing Subclipse.

Step 12:
Finally, after restarting Eclipse, the first thing you will typically want to do is open the Subclipse Repository perspective where you can define your repositories. Be sure to also check the online help as well as the Subclipse preferences located under Team -> SVN.

OK
到此你的插件已经安装完毕了,说明一下,在Step 5中选择的是在线安装,也可以在http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91下载后进行本地安装,本地安装选择New Local Sit...,然后找到解压出来的那个文件夹,后面的都一样了。
卸载的方法也很简单,也是点击 Help => Software Updates => Manage Configuration

按上图操作就可以卸载了。
二、Use Subclipse in Eclipse 3.x(使用)
先向版本库中加入一个Eclipse工程,我这里是随便搭建的一个WEB工程 SVNtest ,将它导入版本库svn://localhost/ts(这使用本机装的版本库,其他机器就要打ip地址,之前说过)。导入后用版本库浏览器找到你导入的工程目录,把其下WebRoot/WEB-INF/classes目录删掉(注意:不删出以后会报错,原因后面再讨论)这些初始化的操作都用客户端工具完成的,毕竟插件的功能还不是那么强大。{注意:不要关闭命令行窗口,关闭窗口也会把svnserve停止。}
把需要进行的项目导入到版本控制的库中,就是 右键->TortoiseSVN->导入

1、在地址栏中输入版本库也就是服务器的地址,例如:svn://localhost/.
2、然后点击右键,创建文件夹。

4、在你想导入的文件夹目录下,点击右键->TortoiseSVN->导入->输入地址,例如svn://localhost/ts 就会把这个项目倒入到ts文件夹下面

5、点击”确定”将进行导入

做好以上的准备后打开Eclipse编译器,点击编译器右上角的Open Perspective (打开透视图) 这个图标 ,打开SVN资源库界面,新建一个资源库

选择资源库的位置,这里我们就用刚才搭好的 svn://localhost/ts 作为工程目录,点击Finish后如果成功则会看到版本服务器中工程的树形结构了(可能需要用户密码验证)。在svn://localhost/ts 根目录上点右键,选择“验出”(英文版的可能叫 Check Out),在弹出窗口中选择“作为空间的项目验出”,下边的项目名称随便叫,我这里还是用 SVNtest 作为项目名称。

一切没有问题了点击Finish。之后它就会从服务器上把工程下到你本地了。好啦,来到Eclipse编辑栏会发现刚才下的工程文件都会带有SVN版本控制标记了,再去Workspace看看,也会发现下载的工程文件夹,并且也有控制标记。 而且里我们会发现在SVN控制下的文件多出来一个Team选单,打开一看原来就是一个客户端工具呀,提交,更新,同步,合并,切换……我们再熟悉不过了,自己试试吧 ^_^。
当要提交的时候,这个是中文的页面,下面的是英文的页面

顺便说一下刚才为什么要删除class目录,起初我没有删掉它,更改提交没有问题,但在更新时总是报错:……Working copy not locked; this is probably a bug, please report svn:……,提示就是class目录下的.svn有毛病,到http://www.tigris.org查找解决方法,有一段描述:
This message is coming straight out of the Subversion library, so technically it is Subversion asking you to report the problem to them. This error message is kind of their general error message when something really unexpected happens. In the case of Eclipse, the problem is almost always one specific thing. The problem is that your Eclipse build folder was versioned and added to your repository. What happens is that when Eclipse does a full build it will delete everything in this folder, including the ".svn" metadata folder. When Subversion cannot find this folder it issues the above error.
The solution is to delete this folder from your repository, which you can do from the SVN Repositories view. Then try deleting the folder from your working copy and perforiming an update. You might need to checkout your project again. Once you have a valid project again, be sure to add the build folder to the svn:ignore property of its parent folder so that the problem does not happen again.
If this is not your problem, then as best as you can try to figure out what might have led up to having this problem and report it on th Subversion users@subversion.tigris.org mailing list
大意:重新部署工程时会将文件夹WEB-INF/classes下的内容全删了,包括".svn"这个文件夹,从面导致SVN找不到这个文件夹的信息,于是报错。 解决的方法是在SVN仓库内将classes下的内容清空,然后在确保本地工程已完全提交的情况下,将本地工程包括文件删除,再从SVN仓库中重新取出。 导致此问题的原因善不明确,估计是往这个文件夹手动添加了文件。
安装方面就介绍到此吧,如果有什么问题在联系我吧。QQ 154813310
相关资源Subversion http://subversion.tigris.org/
TortoiseSVN http://tortoisesvn.net/downloads http://tortoisesvn.tigris.org/
Svn1ClickSetup http://svn1clicksetup.tigris.org/
Subclipse http://subclipse.tigris.org/
Subversion中文站 http://www.subversion.org.cn/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: