How to install list of eclipse plugins from a script? - eclipse

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?

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

You can use the p2 director application to install Eclipse features with a script. Here are some more links that may help.

Related

Installing eclipse plugin via command line [Windows]

i wanted to install a eclipse plugin via the command line and not with the eclipse gui and not with the dropin folder.
i found out that it is possible with this command:
eclipsec.exe -application org.eclipse.equinox.p2.director
-repository http://download.eclipse.org/releases/helios/
-installIU org.eclipse.cdt.feature.group
-tag AddCDT
but i have no idea how the command looks like when i download the plugin as .zip and install it from my local C: drive
e.g my plugin folder looks like this:
C:\MyPlugin\
\plugins\
\features\
......xml
many thanks
Use something like:
-repository jar:file:/C:/temp/your_zipped_plugin.zip!/
(found this from https://www.ibm.com/docs/en/wdfrhcw/1.4.0?topic=eclipse-silent-installation)

uninstall eclipse features by command line

Installing eclipse features by command line is well known[1].
However, I have a problem to uninstall eclipse features by command line.
I use the following command.
/opt/eclipse/eclipse \
-repository \
http://download.eclipse.org/releases/neon,\
https://dl.google.com/eclipse/plugin/4.6,\
http://pydev.org/updates"
-application org.eclipse.equinox.p2.director \
-uninstallIU \
org.eclipse.egit.feature.group,\
org.eclipse.mylyn_feature.feature.group,\
org.eclipse.help.feature.group
The output is the following.
Uninstalling org.eclipse.egit.feature.group 4.4.1.201607150455-r.
Uninstalling org.eclipse.mylyn_feature.feature.group 3.21.0.v20160914-0252.
Uninstalling org.eclipse.help.feature.group 2.2.1.v20161124-1400.
However, when I start the eclipse, the plugins still there.
Any help?
[1] http://blog.vogella.com/2012/04/04/installing-eclipse-features-via-the-command-line-with-the-p2-director/
Make sure to run the p2 garbage collector after uninstallation of the features.
You can run the GC manually from the command line with a command like:
eclipse -application org.eclipse.equinox.p2.garbagecollector.application
-profile SDKProfile
Plug-in jar remains after feature uninstall

Eclipse p2 director application cannot update a feature

I am developing Node.js script to install Eclipse plugins by using Eclipse built-in p2 director application. And p2-director fails to update features in some cases.
D:\Workspaces\Nodeclipse-DEV\nodeclipse-1\org.nodeclipse.ui\templates>node nodeclipse-install.js install -repository jar:file:/D:/Workspaces/Nodeclipse-DEV/nodeclipse-1/org.nodeclipse.site/target/org.nodeclipse.site-0.10.0-SNAPSHOT.zip!/ maven
Nodeclipse CLI Installer (Eclipse Plugin Manager epm)
starting eclipsec -nosplash -application org.eclipse.equinox.p2.director -repository jar:file:/D:/Workspaces/Nodeclipse-DEV/nodeclipse-1/org.nodeclipse.site/target/org.nodeclipse.site-0.10.0-SNAPSHOT.zip!/ -installIU org.nodeclipse.enide.maven.feature.feature.group -tag org.nodeclipse.enide.maven.feature.feature.group -vmargs -Declipse.p2.mirrors=false
Installing org.nodeclipse.enide.maven.feature.feature.group 0.10.0.201402180840.
Installation failed.
Cannot complete the install because of a conflicting dependency.
Software being installed: Enide Maven 0.10.0.201402180840 (org.nodeclipse.enide.maven.feature.feature.group 0.10.0.201402180840)
Software currently installed: Enide Maven 0.10.0.201402170319 (org.nodeclipse.enide.maven.feature.feature.group 0.10.0.201402170319)
Only one of the following can be installed at once:
Enide Maven 0.10.0.201402180840 (org.nodeclipse.enide.maven.feature.feature.jar 0.10.0.201402180840)
Enide Maven 0.10.0.201402170319 (org.nodeclipse.enide.maven.feature.feature.jar 0.10.0.201402170319)
Cannot satisfy dependency:
From: Enide Maven 0.10.0.201402170319 (org.nodeclipse.enide.maven.feature.feature.group 0.10.0.201402170319)
To: org.nodeclipse.enide.maven.feature.feature.jar [0.10.0.201402170319]
Cannot satisfy dependency:
From: Enide Maven 0.10.0.201402180840 (org.nodeclipse.enide.maven.feature.feature.group 0.10.0.201402180840)
To: org.nodeclipse.enide.maven.feature.feature.jar [0.10.0.201402180840]
Application failed, log file location: E:\Eclipse\Enide-Studio-2014-try2-win64\eclipse\configuration\1392717353881.log
eclipsec process exit code 13
I also tried passing both .feature.jar and feature.group.
eclipsec -nosplash -application org.eclipse.equinox.p2.director -repository jar:file:/D:/Workspaces/Nodeclipse-DEV/nodeclipse-1/org.nodeclipse.site/target/org.nodeclipse.site-0.10.0-SNAPSHOT.zip!/ -installIU org.nodeclipse.enide.maven.feature.feature.group -tag org.nodeclipse.enide.maven.feature.feature.group -vmargs -Declipse.p2.mirrors=false
This maybe related to the fact that .maven feature includes .maven and .common plugins. .common plugin is also used by other features.
However this also happens with other features, that have no shared dependencies. p2 director help page does not specify the logic nor gives references.
On the p2 director level, there is no 'update' operation. Instead, you need to tell the director to both 'uninstall' and 'install' the IU that you want to be updated:
eclipse -application org.eclipse.equinox.p2.director -uninstallIU org.nodeclipse.enide.maven.feature.feature.group -installIU org.nodeclipse.enide.maven.feature.feature.group -repository ...

How to uninstall an Eclipse plugin via command line?

I recently installed Bravo Editor plugin into my Eclipse and it has crashed the installation of Eclipse, now I'm unable to start it.
I've already tried to call it from the command line with eclipse -clean, but it's no use.
I'd like to know how it could be uninstalled from the command line.
You can try using Eclipse Director and put com.beck.ep.feature.group as argument for -uninstallIU
The full command for this is:
eclipse -application org.eclipse.equinox.p2.director -uninstallIU com.beck.ep.feature.group
(Use eclipsec.exe on Windows.)
You can list the installed features to find the right ID with:
eclipse -application org.eclipse.equinox.p2.director -listInstalledRoots

Installing plugin into eclipse using command line

I have an update site, and got the directory which contains the features and plugins
How to install the plugin in eclipse application using the command line ?
I want to automate this process
You can invoke p2 director application using something like this:
eclipsec.exe
-application org.eclipse.equinox.p2.director
-repository http://download.eclipse.org/releases/galileo/
-installIU org.eclipse.cdt.feature.group
-destination d:/eclipse/
-profile SDKProfile
Here is also link to p2 wiki.