2013-03-07 3 views
18

私は非常にカスタマイズされたEclipse環境のコーディング環境を、完全に無人でLinuxのスクリプトからセットアップする必要があります。カスタマイズされたEclipse環境では、さまざまなソース(protobuf、pydev、cmakeed、openinterminal、egit、yaml、webpageeditorなど)から約10種類のプラグインをインストールする必要があります。 guiで毎回手動で行うには20〜30分かかります。私はスクリプトでプラグインのインストールを自動化したいので、linuxを実行している人は誰もが人間の介在なしにプラグインのカスタムセットを使ってEclipse環境を作り直すことができます。誰でもこれを行う方法についてのアドバイスがありますか?スクリプトからEclipseプラグインのリストをインストールするには?

+0

の可能性重複( http://stackoverflow.com/questions/7163970/how-do-you-automate-the-installation-of-eclipse-plugins-with-command-line) – 030

答えて

18

私の好きなプラグイン(Eclipse Indigo 3.7でテスト済み)をインストールするためのコマンドラインスニペットは次のとおりです...このトリックは、パッケージのinstallIUパラメータの値を把握することです... Eclipse GUIインストーラウィンドウで目的のパッケージが選択されているときに「more」リンクをクリックすると、これが表示されます。

cmakeed - CMake editor

eclipse -nosplash -application org.eclipse.equinox.p2.director -repository http://download.eclipse.org/releases/indigo/,http://cmakeed.sourceforge.net/eclipse/ -installIU com.cthing.cmakeed.feature.feature.group 

OpenInTerminal - Add option in context menu

eclipse -nosplash -application org.eclipse.equinox.p2.director -repository http://download.eclipse.org/releases/indigo/,http://eclipse-openinterminal.googlecode.com/svn/trunk/site/ -installIU OpenInTerminal.feature.group 

protobuf-dt - Google Protobuffer editor

eclipse -nosplash -application org.eclipse.equinox.p2.director -repository http://download.eclipse.org/releases/indigo/,http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/,http://protobuf-dt.googlecode.com/git/update-site -installIU com.google.eclipse.protobuf.feature.group 
yedit - YAML Editor


eclipse -nosplash -application org.eclipse.equinox.p2.director -repository http://download.eclipse.org/releases/indigo/,http://dadacoalition.org/yedit -installIU org.dadacoalition.yedit.feature.group 

shelled - Bash Script Editor

eclipse -nosplash -application org.eclipse.equinox.p2.director -repository http://download.eclipse.org/releases/indigo/,http://download.eclipse.org/technology/dltk/updates/,https://sourceforge.net/projects/shelled/files/shelled/update/ -installIU net.sourceforge.shelled.feature.group 

のWebページエディタ

eclipse -nosplash -application org.eclipse.equinox.p2.director -repository http://download.eclipse.org/releases/indigo/ -installIU org.eclipse.jst.webpageeditor.feature.feature.group 

PyDevは
それは、証明書のモミをインストールする必要があるため、PyDevはトリッキーですトン...ここでは、そのステップを自動化するスクリプトです:

#!/usr/bin/python 
# Add PyDev's certificate to Java's key and certificate database 
# Certificate file here: http://pydev.org/pydev_certificate.cer 
import os, sys, pexpect, urllib2 
def main(): 
    # NOTE: You may have to update the path to your system's cacerts file 
    certs_file = '/usr/lib/jvm/default-java/jre/lib/security/cacerts' 
    pydev_certs_url = 'http://pydev.org/pydev_certificate.cer' 
    print "Adding pydev_certificate.cer to %s" % (certs_file) 
    pydev_cert = open('pydev_certificate.cer', 'w') 
    pydev_cert.write(urllib2.urlopen(pydev_certs_url).read()) 
    pydev_cert.close() 
    cmd = "keytool -import -file ./pydev_certificate.cer -keystore %s" % (certs_file) 
    child = pexpect.spawn(cmd) 
    child.expect("Enter keystore password:") 
    child.sendline("changeit") 
    if child.expect(["Trust this certificate?", "already exists"]) == 0: 
    child.sendline("yes") 
    try: 
    child.interact() 
    except OSError: 
    pass 
    print "done" 

if __name__ == "__main__": 
    main() 

次に、あなたが実行することができます[?どのコマンドラインとEclipseプラグインのインストールを自動化します]

eclipse -nosplash -application org.eclipse.equinox.p2.director -repository http://download.eclipse.org/releases/indigo/,http://pydev.org/updates/ -installIU org.python.pydev.feature.feature.group 
+0

これはウィンドウでも機能し、eclipse実行ファイルのパスに '.exe'を追加するだけです。 Pythonスクリプトに関しては、Pythonで実行するか、 '/ usr/bin/python'で修正する必要があります。ほとんどの設定では動作せず、pexpectモジュールは現在Windows上で動作しません。これらの問題はどちらもCygwinで解決されるかもしれませんが、私はそれを使用しないので、私は確認できません。 – bschlueter

関連する問題