How do you automate the installation of Eclipse plugins with command line?
I could find these two docs which helped :
- http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Frunning_eclipse.htm
- http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/p2_director.html
Install freshly downloaded Eclipse Classic :
sudo tar -xvzf eclipse-SDK-3.7-linux-gtk.tar.gz -C /usr/local/
To install desired CDT features (references found by using Eclipse's "Help>Install new software" tool)
- C/C++ Development Tools ( org.eclipse.cdt.feature.group )
- C/C++ Development Tools SDK ( org.eclipse.cdt.sdk.feature.group )
- C/C++ Development Platform ( org.eclipse.cdt.platform.feature.group )
- C/C++ Memory View Enhancements ( org.eclipse.cdt.debug.ui.memory.feature.group )
- Eclipse Debugger for C/C++ ( org.eclipse.cdt.debug.edc.feature.group )
- Miscellaneous C/C++ Utilities ( org.eclipse.cdt.util.feature.group )
run :
sudo /usr/local/eclipse/eclipse -nosplash \
-application org.eclipse.equinox.p2.director \
-repository http://download.eclipse.org/releases/indigo/,http://download.eclipse.org/tools/cdt/releases/helios/ \
-destination /usr/local/eclipse \
-installIU org.eclipse.cdt.feature.group \
-installIU org.eclipse.cdt.sdk.feature.group \
-installIU org.eclipse.cdt.platform.feature.group \
-installIU org.eclipse.cdt.debug.ui.memory.feature.group \
-installIU org.eclipse.cdt.debug.edc.feature.group \
-installIU org.eclipse.cdt.util.feature.group
To install PyDev, we first need to insert their auto-signed certificate (which can be found here : http://pydev.org/pydev_certificate.cer )
#!/usr/bin/env python
# add PyDev's certificate to Java's key and certificate database
# Certificate file can be downloaded here : http://pydev.org/pydev_certificate.cer
import os, sys
import pexpect
print "Adding pydev_certificate.cer to /usr/lib/jvm/java-6-openjdk/jre/lib/security/cacerts"
cwd = os.path.abspath (os.path.dirname(sys.argv[0]))
child = pexpect.spawn("keytool -import -file ./pydev_certificate.cer -keystore /usr/lib/jvm/java-6-openjdk/jre/lib/security/cacerts")
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"
so run it :
sudo ./add_pydev_certificate.py
The desired PyDev features are :
- PyDev for Eclipse ( org.python.pydev.feature.feature.group )
run :
sudo /usr/local/eclipse/eclipse -nosplash \
-application org.eclipse.equinox.p2.director \
-repository http://pydev.org/updates/ \
-destination /usr/local/eclipse \
-installIU org.python.pydev.feature.feature.group
How to install list of eclipse plugins from a script?
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
Installing plugin into eclipse using command line
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.
Building Eclipse plugins and features on the command line
Given that all the answers to this question are all 3-5 years old, I figure an update would be useful to others.
For those who want to add the building of Eclipse plugins to the CI process, I recommend they check out the Eclipse Tycho project. This is essentially a Maven plugin that allows you you to wrap eclipse projects within Maven project. With this we use Atlassian Bamboo to build our Eclipse plugin. This also allows us to use the Maven jarsigner plugin to sign our plugin files.
How to automate pmd eclipse plugin execution?
The eclipse plugin uses PMD to analyse the files. If you want to automate the analysis then you want to use PMD directly, not the eclipse plugin.
Take a look at the class PMD. It has the static method PMD.doPMD(configuration) which starts the analysis. The same class also contains the main method in case you want to start it like from the command line.
You can find an example of how to invoke PMD.doPMD(configuration) in the method Analyser.runPMD() of the eclipse plugin.
Boostrapping new Eclipse machines with all the Plugins
Solution 1 is too search for more advanced Eclipse distributions.
For example, STS (Spring Tool Suite) comes with
- AspectJ
- EGit
- m2e
- (and of course) Spring IDE
Related Topics
How to Configure a Systemd Service to Restart Periodically
How to Put the Current Running Linux Process in Background
How to Run Multiple Tor Processes at Once with Different Exit Ips
How to Set Up Curl to Permanently Use a Proxy
Amazon Linux: "Apt-Get: Command Not Found"
Compile/Run Assembler in Linux
How to Check in Bash Whether a File Was Created More Than X Time Ago
How to Map a Hostname *And* a Port with /Etc/Hosts
How to Tar Certain File Types in All Subdirectories
How to Find Files Recursively by File Type and Copy Them to a Directory
How to Convert an Image to Grayscale via the Command Line
How to Pack Multiple Library Archives (.A) into One Archive File
Where Is the Linux Isr Entry Point
How to Remove All Lines from a Text File Starting at First Empty Line
How to Solve "Server Terminated Early with Status 127" When Running Node.Js on Linux
How to Use an Older Version of Gcc in Linux