2013-03-07 4 views
18

Ich brauche eine Möglichkeit, eine hoch angepasste Eclipse-Codierumgebung völlig unbeaufsichtigt aus einem Skript in Linux zu erstellen. Die angepasste Eclipse-Umgebung erfordert die Installation von etwa 10 verschiedenen Plugins aus verschiedenen Quellen (protobuf, pydev, cmakeed, openinterminal, egit, yaml, webpageeditor usw.). Wenn Sie dies jedes Mal manuell mit der GUI machen, dauert dies 20-30 Minuten. Ich möchte die Installation von Plugins in einem Skript automatisieren, so dass jeder, der Linux ausführt, meine Eclipse-Umgebung mit einem benutzerdefinierten Satz von Plugins ohne menschliche Interaktion neu erstellen kann. Hat jemand Tipps, wie man das macht?Wie installiert man die Liste der Eclipse-Plugins von einem Skript?

+0

Mögliche Duplikat (http://stackoverflow.com/questions/7163970/how-do-you-automate-the-installation-of-eclipse-plugins-with-command-line) – 030

Antwort

18

Hier sind die Befehlszeilen-Snippets, um einige meiner Lieblings-Plugins zu installieren (getestet auf Eclipse Indigo 3.7) ... Der Trick ist, den Wert des "installIU" -Parameters für das Paket herauszufinden ... Die Eclipse-GUI Dies wird angezeigt, wenn Sie auf "mehr" klicken, wenn das gewünschte Paket im Installationsfenster ausgewählt wurde.

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-Seite Editor

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 ist schwierig, weil es erfordert ein Zertifikat Tannen Installation t ... Hier ist ein Skript, das diesen Schritt automatisiert:

#!/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() 

Dann können Sie laufen: [? Wie beurteilen Sie die Installation von Eclipse-Plugins mit Befehlszeile automatisieren]

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

Dies funktioniert auch in Windows, fügen Sie einfach '.exe' an den Pfad zur Eclipse-Programmdatei an. Was das Python-Skript betrifft, müsste es mit Python ausgeführt werden oder modifiziert werden, da '/ usr/bin/python' in den meisten Setups nicht funktioniert und das Pexpect-Modul derzeit nicht in Windows funktioniert. Beide Probleme können mit Cygwin gelöst werden, ich benutze es nicht, also kann ich nicht bestätigen. – bschlueter