Svn是一個開源的版本控制系統Subversion的簡稱。Subversion 管理著隨時間改變的數據。 這些數據放置在一個中央資料檔案庫 (repository) 中。 這個檔案庫很像一個普通的文件服務器,不過它會記住每一次文件的變動。 這樣你就可以把檔案恢復到舊的版本,或是瀏覽文件的變動歷史。
SVN版本控制需要SVN服務器(可下載SVN安裝或安裝VisualSVN Server)和SVN客戶端軟件(Subclipse即Eclipse的SVN客戶端插件或者TortoiseSVN)。
subclipse安裝
一、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目錄刪掉(注意:不刪出以后會報錯,原因后面再討論)這些初始化的操作都用客戶端工具完成的,畢竟插件的功能還不是那么強大。
做好以上的準備后打開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倉庫中重新取出。 導致此問題的原因善不明確,估計是往這個文件夾手動添加了文件。
- PC官方版
- 安卓官方手機版
- IOS官方手機版