Installing plugin into eclipse using command line - eclipse

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.

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 install list of eclipse plugins from a script?

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.

Run plugin updates outwith Eclipse UI

I'm trying to update the plugins for an Eclipse Galileo SR2 installation from the command line.
Something similar to this command (which asks for a specific feature):
java -jar org.eclipse.equinox.launcher_*.jar -application org.eclipse.update.core.standaloneUpdate -command update
Does anyone know if a command exists using p2 or any other Eclipse application runner?
I was able to upgrade Eclipse Classic Galileo from SR1 to SR2 using the following command:
java -jar plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
-application org.eclipse.equinox.p2.director
-installIU org.eclipse.sdk.ide
-uninstallIU org.eclipse.sdk.ide
-artifactRepository http://download.eclipse.org/releases/galileo
-metadataRepository http://download.eclipse.org/releases/galileo
-profile SDKProfile
-flavor tooling
-destination C:\eclipse
-p2.os win32 -p2.ws win32 -p2.arch x86
The director doesn't do updates currently, but doing both uninstall and install is equivalent. See bug 279659
The install/uninstall value org.eclipse.sdk.ide will depend on what exactly you have installed. Here this is the classic Eclipse SDK. If you are running something else you need to find the root installable unit id. Go to Help -> About -> Installation Details -> Installed Software. Look for the id of the root node of the tree. "Eclipse IDE for C/C++ Developers" is epp.package.cpp. "Eclipse IDE for Java Developers" is epp.package.java.
The -profile value SDKProfile also depends on what package you are running. Check the eclipse.p2.profile property in your config.ini file.
The -destination C:\eclipse is the eclipse I am upgrading which is also the eclipse I'm using to run this command.