Svn是一個(gè)開(kāi)源的版本控制系統(tǒng)Subversion的簡(jiǎn)稱(chēng)。Subversion 管理著隨時(shí)間改變的數(shù)據(jù)。 這些數(shù)據(jù)放置在一個(gè)中央資料檔案庫(kù) (repository) 中。 這個(gè)檔案庫(kù)很像一個(gè)普通的文件服務(wù)器,不過(guò)它會(huì)記住每一次文件的變動(dòng)。 這樣你就可以把檔案恢復(fù)到舊的版本,或是瀏覽文件的變動(dòng)歷史。
SVN版本控制需要SVN服務(wù)器(可下載SVN安裝或安裝VisualSVN Server)和SVN客戶(hù)端軟件(Subclipse即Eclipse的SVN客戶(hù)端插件或者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
到此你的插件已經(jīng)安裝完畢了,說(shuō)明一下,在Step 5中選擇的是在線安裝,也可以在http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91下載后進(jìn)行本地安裝,本地安裝選擇New Local Sit...,然后找到解壓出來(lái)的那個(gè)文件夾,后面的都一樣了。
卸載的方法也很簡(jiǎn)單,也是點(diǎn)擊 Help => Software Updates => Manage Configuration
按上圖操作就可以卸載了。
二、Use Subclipse in Eclipse 3.x(使用)
先向版本庫(kù)中加入一個(gè)Eclipse工程,我這里是隨便搭建的一個(gè)WEB工程 SVNtest ,將它導(dǎo)入版本庫(kù)svn://localhost/ts(這使用本機(jī)裝的版本庫(kù),其他機(jī)器就要打ip地址,之前說(shuō)過(guò))。導(dǎo)入后用版本庫(kù)瀏覽器找到你導(dǎo)入的工程目錄,把其下WebRoot\WEB-INF\classes目錄刪掉(注意:不刪出以后會(huì)報(bào)錯(cuò),原因后面再討論)這些初始化的操作都用客戶(hù)端工具完成的,畢竟插件的功能還不是那么強(qiáng)大。
做好以上的準(zhǔn)備后打開(kāi)Eclipse編譯器,點(diǎn)擊編譯器右上角的Open Perspective 打開(kāi)SVN資源庫(kù)界面,新建一個(gè)資源庫(kù)
選擇資源庫(kù)的位置,這里我們就用剛才搭好的 svn://localhost/ts 作為工程目錄,點(diǎn)擊Finish后如果成功則會(huì)看到版本服務(wù)器中工程的樹(shù)形結(jié)構(gòu)了(可能需要用戶(hù)密碼驗(yàn)證)。在svn://localhost/ts 根目錄上點(diǎn)右鍵,選擇“驗(yàn)出”(英文版的可能叫 Check Out),在彈出窗口中選擇“作為空間的項(xiàng)目驗(yàn)出”,下邊的項(xiàng)目名稱(chēng)隨便叫,我這里還是用 SVNtest 作為項(xiàng)目名稱(chēng)。
一切沒(méi)有問(wèn)題了點(diǎn)擊Finish。之后它就會(huì)從服務(wù)器上把工程下到你本地了。好啦,來(lái)到Eclipse編輯欄會(huì)發(fā)現(xiàn)剛才下的工程文件都會(huì)帶有SVN版本控制標(biāo)記了,再去Workspace看看,也會(huì)發(fā)現(xiàn)下載的工程文件夾,并且也有控制標(biāo)記。 而且里我們會(huì)發(fā)現(xiàn)在SVN控制下的文件多出來(lái)一個(gè)Team選單,打開(kāi)一看原來(lái)就是一個(gè)客戶(hù)端工具呀,提交,更新,同步,合并,切換……我們?cè)偈煜げ贿^(guò)了,自己試試吧 ^_^。
順便說(shuō)一下剛才為什么要?jiǎng)h除class目錄,起初我沒(méi)有刪掉它,更改提交沒(méi)有問(wèn)題,但在更新時(shí)總是報(bào)錯(cuò):……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
大意:重新部署工程時(shí)會(huì)將文件夾WEB-INF/classes下的內(nèi)容全刪了,包括".svn"這個(gè)文件夾,從面導(dǎo)致SVN找不到這個(gè)文件夾的信息,于是報(bào)錯(cuò)。 解決的方法是在SVN倉(cāng)庫(kù)內(nèi)將classes下的內(nèi)容清空,然后在確保本地工程已完全提交的情況下,將本地工程包括文件刪除,再?gòu)腟VN倉(cāng)庫(kù)中重新取出。 導(dǎo)致此問(wèn)題的原因善不明確,估計(jì)是往這個(gè)文件夾手動(dòng)添加了文件。
- PC官方版
- 安卓官方手機(jī)版
- IOS官方手機(jī)版