1.Local Eclipse update site 2.drop-ins.很多插件的下載地址都提供了offline-update-size.zip的形式,然后用采用本地更新,可以很方便的安裝插件,這是在你網(wǎng)絡(luò)情況不是特別好的情況下非常好的一個(gè)選擇.
不過這里我主要想著重講一下dropins,因?yàn)槲矣X得很多用它加載插件存在很多誤區(qū),而這些誤區(qū)會(huì)讓你出現(xiàn)很多莫名其妙的問題.比如昨天我折騰了幾個(gè)插件的drop-ins安裝,遇到了如下幾個(gè)問題:
1.如加載supclipse插件,從網(wǎng)上下載的離線包是subclipse-1.10.6.zip,然后解壓放進(jìn)dropins.然后重啟eclipse,可能會(huì)發(fā)現(xiàn)沒有問題.插件正常加載了.如果問題就這么簡(jiǎn)單的話,那就沒必要寫這篇隨筆.
2.后續(xù)又用這種方式安裝了插件color-theme,jd等插件.這時(shí)候再重啟eclipse,發(fā)現(xiàn)所有的插件都不好用了包括之前的subclipse.這時(shí)候你打開Error視圖,可以很到很多加載插件的錯(cuò)誤.當(dāng)然網(wǎng)上很多資料說可以再eclipse啟動(dòng)時(shí)clean一下抑或是修改Config.ini等.這個(gè)有時(shí)候?qū)σ恍┎寮赡芗虞d可能沒有問題,但是這并不能解決所有問題。比如你更改了一下dropins下子目錄的名字,如將subclipse改成大寫或者新增,移除某一個(gè)子目錄,會(huì)有這樣或者那樣的問題,而最終導(dǎo)致的結(jié)果就是不是所有的在dropins下的插件都能正常加載,如subclipse插件沒問題,但是color-theme插件有問題,這個(gè)時(shí)候你會(huì)非常頭痛!
所以這里有必要講一下dropins加載插件需要注意的地方,參考自:https://wiki.eclipse.org/Stardust/Knowledge_Base/Getting_Started/Installation,這里我貼出一段:
- Install features as drop-ins - This is a good choice if you:
- know what you are doing
- are sure that you have the right Eclipse version with all required dependencies installed
- are familiar enough with the eclipse plug-in mechanism and know how to install missing dependencies if needed
- rather perform some steps in the file system than walk through the dialogs of the (local) Eclipse update site installation
- want to separate the new features from you Eclipse installation on file system level
- want to automate the installation for multiple environments
1.要注意和Eclipse版本的兼容性問題.這里舉一個(gè)明顯的例子就是m2e.m2e 1.5.0 requires Eclipse Luna. It will not work with Kepler or Indigo.參見:http://stackoverflow.com/questions/24479109/maven-for-eclipse-1-5-0-plugin-cannot-be-installed-under-kepler
2.你要十分熟悉eclipse的插件機(jī)制并且知道如何安裝所需的全部依賴(因?yàn)閑clipse插件安裝需要依賴很多其他的庫)
3.和Local Eclipse update site installation的圖形界面對(duì)話框似的操作對(duì)比,你需要自己在文件系統(tǒng)做一些處理...
......
從上述來看,并非是任何一個(gè)人直接拿一個(gè)離線插件包解壓縮扔到dropins目錄就行,這里涉及到版本兼容,依賴,額外處理的很多東西.這里再舉一個(gè)例子,參見:https://developer.jboss.org/thread/149349?tstart=0,這里提到一個(gè)解釋,我覺得很好,即"We no longer provide a "runnable" zip of all of JBoss Tools for install-by-unzip into dropins, because installation that way is error-prone (particularly on Windows) and doesn't bring in third-party dependencies like birt, maven, or svn",從這里明顯看出并未簡(jiǎn)單的一個(gè)zip包解壓放到dropins目錄就能處理所有問題.
通過以上,得出一個(gè)結(jié)論就是:用dropins安裝zip插件遠(yuǎn)遠(yuǎn)不是那么簡(jiǎn)單->那么給遵循一個(gè)什么原則呢?
1.查看下載的zip包,如果是類似于update-site的zip包,其實(shí)這是離線更新包,正確的安裝用法應(yīng)該是用Eclipse Local update site installation.->這種包不應(yīng)該放到dropins,即便有幾率會(huì)成功,但是是非常規(guī)手段。
2.雖然有些zip包名字是類似update-site的包,但是其解壓縮后只有features和plugins兩個(gè)子目錄而沒有額外的東西,這樣的包其實(shí)很多直接解壓放到dropins目錄下進(jìn)行加載的。
3.查看zip包內(nèi)容,如果包含content.jar/artifacts.jar/site.xml等文件的,一定要用Local update site installtion.因?yàn)檫@種是插件更新包,是專門用來本地更新安裝的,會(huì)裝額外的依賴等.
參考:http://stackoverflow.com/questions/5482554/how-to-install-plugin-for-eclipse-from-zip
最后,附錄幾個(gè)m2e各個(gè)版本插件的update-site.zip包(大家懂得,在線安裝m2e是很痛苦的),這些包是我一個(gè)個(gè)在https://www.eclipse.org/m2e/m2e-downloads.html,進(jìn)入所有版本的目錄(Show Directory Contents)將zip內(nèi)所有的東西全部下載然后整合到一起的.吐槽一下m2e插件的下載,不給提供zip下載,只讓你看到zip內(nèi)的東西...。當(dāng)然這里我推薦大家用Eclipse 4.4,Luna,其內(nèi)置了m2e,且其插件版本是比較新的1.5.0.20140606-0033.
那么我最后提問一下,這個(gè)m2e離線更新包如何安裝呢?哈哈,當(dāng)然是采用Local update site installtion,千萬注意不要用dropins,會(huì)加載不了,因?yàn)楹芏嘁蕾噯栴}解決不了!
附m2e各版本update-site.zip包網(wǎng)盤下載地址:http://pan.baidu.com/s/1qW0onvu