﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-希望与大家一起分享Java-文章分类-CVS团队开发</title><link>http://www.blogjava.net/haoqingshi/category/2741.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 08:49:01 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 08:49:01 GMT</pubDate><ttl>60</ttl><item><title>在Eclipse中使用CVS（转贴）</title><link>http://www.blogjava.net/haoqingshi/articles/10184.html</link><dc:creator>Java&amp;Inter</dc:creator><author>Java&amp;Inter</author><pubDate>Tue, 16 Aug 2005 00:46:00 GMT</pubDate><guid>http://www.blogjava.net/haoqingshi/articles/10184.html</guid><wfw:comment>http://www.blogjava.net/haoqingshi/comments/10184.html</wfw:comment><comments>http://www.blogjava.net/haoqingshi/articles/10184.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/haoqingshi/comments/commentRss/10184.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/haoqingshi/services/trackbacks/10184.html</trackback:ping><description><![CDATA[<BR><FONT face=SimSun>版本控制在团队开发中是必不可少的。</FONT><SPAN lang=EN-US>CVS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是优秀的开源版本控制软件，</SPAN><SPAN lang=EN-US>Eclipse</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">本身就内置了对</SPAN><SPAN lang=EN-US>CVS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的支持，只需简单配置，即可使用</SPAN><SPAN lang=EN-US>CVS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><BR><BR>首先我们要正确安装并配置好</SPAN><SPAN lang=EN-US>CVS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">服务器，通常</SPAN><SPAN lang=EN-US>Linux Server</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">都自带</SPAN><SPAN lang=EN-US>CVS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">服务，不过命令行操作比较繁琐。</SPAN><SPAN lang=EN-US>Windows</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下也有简单易用的</SPAN><SPAN lang=EN-US>CVS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">服务器，这里我们推荐</SPAN><SPAN lang=EN-US>CVSNT</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，可以下载</SPAN><SPAN lang=EN-US>CVSNT <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:chsdate IsROCDate="False" IsLunarDate="False" Day="30" Month="12" Year="1899" w:st="on">2.<st1:chmetcnv w:st="on" TCSC="0" NumberType="1" Negative="False" HasSpace="False" SourceValue=".51" UnitName="a">0.51a</st1:chmetcnv></st1:chsdate></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，安装并启动</SPAN><SPAN lang=EN-US>CVSNT</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：<BR><BR><IMG alt=cvsnt-1 hspace=0 src="http://blog.csdn.net/images/blog_csdn_net/asklxf/69875/o_cvs1.jpg" align=baseline border=0><BR><BR><BR><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">然后切换到</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Repositories</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">面板，添加一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Repository</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，命名为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">/cvs-java</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">CVSNT</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">会提示是否初始化这个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Repository</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，选择是：<BR><BR><IMG alt=cvsnt2 hspace=0 src="http://blog.csdn.net/images/blog_csdn_net/asklxf/69875/o_cvs2.jpg" align=baseline border=0><BR><BR><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">然后在</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Advanced</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">面板上选中“</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Pretend to be a Unix CVS version</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”：</SPAN><BR></SPAN><BR><IMG alt=cvsnt3 hspace=0 src="http://blog.csdn.net/images/blog_csdn_net/asklxf/69875/o_cvs3.jpg" align=baseline border=0><BR><BR>然后，在Windows账户中为每一个开发人员添加用户名和口令。<BR><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><BR>现在，</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">CVSNT</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的安装配置已经完成，下一步，启动</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Eclipse</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，我们可以使用原有的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Hello</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">工程，或者新建一个</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Project</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，然后选择菜单</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Window-&gt;Show View-&gt;Other</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，打开</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">CVS-&gt;CVS Repositories</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</SPAN><BR><BR><IMG alt=eclipse-cvs1 hspace=0 src="http://blog.csdn.net/images/blog_csdn_net/asklxf/69875/o_eclipse-cvs1.jpg" align=baseline border=0><BR><BR><BR><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">然后点击按钮<IMG alt=cvs-add-button hspace=0 src="http://blog.csdn.net/images/blog_csdn_net/asklxf/69875/o_cvs-add-button.jpg" align=absMiddle border=0></SPAN><SPAN lang=EN-US></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，添加一个</SPAN><SPAN lang=EN-US>Repository</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</SPAN><BR><BR><IMG alt=add-cvs-repository hspace=0 src="http://blog.csdn.net/images/blog_csdn_net/asklxf/69875/o_add-cvs-rep.jpg" align=baseline border=0><BR><BR><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注意用户名和口令直接填</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Windows</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的用户名和口令，然后选中“</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Validate Connection on Finish</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”，点击</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Finish</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">完成：</SPAN><BR><BR><IMG alt=eclipse-cvs2 hspace=0 src="http://blog.csdn.net/images/blog_csdn_net/asklxf/69875/o_eclipse-cvs2.jpg" align=baseline border=0><BR><BR><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">首先，我们要将一个现有的工程放到</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">CVS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">服务器中，切换到</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Package Explorer</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，选中</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Hello</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">工程，右键点击，选择</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Team-&gt;Share Project…</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：<BR><BR><IMG alt=share-proj hspace=0 src="http://blog.csdn.net/images/blog_csdn_net/asklxf/69875/o_share-proj.jpg" align=baseline border=0><BR><BR><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用刚才我们添加的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Repository</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，继续，并将所有文件都添加到</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">CVS</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中，最后</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Eclipse</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提示</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">Commit</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</SPAN><BR><BR></SPAN><IMG alt=cvs-commit1 hspace=0 src="http://blog.csdn.net/images/blog_csdn_net/asklxf/69875/o_cvs-commit1.jpg" align=baseline border=0><BR><BR>
<P class=MsoNormal><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">填入一个简单的注释，确定，然后</SPAN><SPAN lang=EN-US>Eclipse</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">会把整个工程提交到</SPAN><SPAN lang=EN-US>CVS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">服务器，可以在</SPAN><SPAN lang=EN-US>Package Explorer</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中看到图标发生了变化，</SPAN><SPAN class=SpellE><SPAN lang=EN-US>Hello.java</SPAN></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件后面会有版本号</SPAN><SPAN lang=EN-US>1.1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。在</SPAN><SPAN lang=EN-US>CVS Repositories</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">面板中刷新，可以看到刚添加进来的工程：</SPAN></P>
<P class=MsoNormal><IMG alt=eclipse-cvs3 hspace=0 src="http://blog.csdn.net/images/blog_csdn_net/asklxf/69875/o_eclipse-cvs3.jpg" align=baseline border=0><BR><BR><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在团队开发中，当创建了一个基本的工程并提交到</SPAN><SPAN lang=EN-US>CVS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">后，别的开发人员首先要</SPAN><SPAN lang=EN-US>Check Out</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这个工程到各自的本地计算机上，这里为了演示，首先我们在</SPAN><SPAN lang=EN-US>Package Explorer</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中删除</SPAN><SPAN lang=EN-US>Hello</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">工程，然后打开</SPAN><SPAN lang=EN-US>CVS Repositories</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（如果没有看到</SPAN><SPAN lang=EN-US>Repository</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">就按照上面的方法添加</SPAN><SPAN lang=EN-US>Repository</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">），选择</SPAN><SPAN lang=EN-US>Hello</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">工程，右键点击，选择</SPAN><SPAN lang=EN-US>Check Out As…</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</SPAN><BR><BR><IMG alt=check-out-as-proj hspace=0 src="http://blog.csdn.net/images/blog_csdn_net/asklxf/69875/o_check-out-as.jpg" align=baseline border=0><BR><BR></P>
<P class=MsoNormal><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">作为一个</SPAN><SPAN lang=EN-US>Project</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">签出，就可以在</SPAN><SPAN lang=EN-US>Package Explorer</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中看到签出的工程。<BR><BR></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">当对某些源文件作了修改后，需要提交更改到</SPAN><SPAN lang=EN-US>CVS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">服务器。选中更改的文件或工程，右键点击，选择</SPAN><SPAN lang=EN-US>Team-&gt;Commit…</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：<BR><BR><IMG alt=cvs-commit hspace=0 src="http://blog.csdn.net/images/blog_csdn_net/asklxf/69875/o_commit2.jpg" align=baseline border=0><BR><BR><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">然后填入简单的注释，就可以提交到</SPAN><SPAN lang=EN-US>CVS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">服务器上了，可以看到源文件的版本号变成了</SPAN><SPAN lang=EN-US>1.2</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。<BR><BR></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">以上简单介绍了如何搭建</SPAN><SPAN lang=EN-US>CVS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">服务器以及在</SPAN><SPAN lang=EN-US>Eclipse</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中如何使用</SPAN><SPAN lang=EN-US>CVS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，可以参考</SPAN><SPAN lang=EN-US>CVS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">手册以便了解</SPAN><SPAN lang=EN-US>Branch</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US>Merge</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等更多功能的使用。<BR></SPAN></SPAN></SPAN><BR></P><img src ="http://www.blogjava.net/haoqingshi/aggbug/10184.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/haoqingshi/" target="_blank">Java&Inter</a> 2005-08-16 08:46 <a href="http://www.blogjava.net/haoqingshi/articles/10184.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>