Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install list of eclipse plugins from a script?

Tags:

I need a way to setup a highly customized eclipse coding environment in a fully unattended way from a script in linux. The customized eclipse environment requires the installation of about 10 different plugins from various sources (protobuf, pydev, cmakeed, openinterminal, egit, yaml, webpageeditor, etc). Doing this manually each time with the gui takes 20-30 minutes. I want to automate the install of plugins in a script so anyone running linux can recreate my eclipse environment with a custom set of plugins without human interaction. Anyone have advice about how to do this?

like image 425
heathbar Avatar asked Mar 07 '13 03:03

heathbar


People also ask

How do I know what Eclipse plugins are installed?

One way of finding out is to select Help > About Eclipse Platform >. From this dialog, click Plug-in Details to get a list of all installed plug-ins, along with vendor and version information.

How do I extract a plugin from Eclipse?

You can export the list of the features and plugins by going to File->Export->Install.


1 Answers

Here are the command line snippets to install some of my favorite plugins (tested on Eclipse Indigo 3.7)... The trick is to figure out the value of the "installIU" parameter for the package... The Eclipse GUI will show this if you click on "more" link when the desired package is selected in the installer window.

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 Page 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 is tricky because it requires installing a certificate first... Here's a script that automates that step:

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

Then you can run:

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 
like image 180
heathbar Avatar answered Sep 30 '22 09:09

heathbar