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?
我需要一种方法来从linux中的脚本以完全无人参与的方式设置高度定制的eclipse编码环境。定制的eclipse环境需要安装来自不同来源的大约10个不同的插件(protobuf、pydev、cmakeed、openinterminal、egit、yaml、webpageeditor等)。每次使用gui手动操作需要20-30分钟。我想在脚本中自动安装插件,这样任何运行linux的人都可以使用一组自定义插件重新创建我的eclipse环境,而无需人工交互。有人有什么建议吗?
2 个解决方案
#1
18
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.
下面是安装我最喜欢的一些插件的命令行代码片段(在Eclipse Indigo 3.7上测试)……诀窍是求出包的“installIU”参数的值……如果在安装程序窗口中选择所需的包时单击“more”链接,Eclipse GUI将显示这一点。
cmakeed——CMake编辑器
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
protobuf-dt -谷歌缓冲编辑器
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编辑器
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
shell - Bash脚本编辑器
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:
Pydev Pydev Pydev很棘手,因为它需要首先安装一个证书……下面的脚本可以自动完成这一步:
#!/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
#2
8
You can use the p2 director application to install Eclipse features with a script. Here are some more links that may help.
可以使用p2 director应用程序使用脚本安装Eclipse特性。下面是一些可能有帮助的链接。
#1
18
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.
下面是安装我最喜欢的一些插件的命令行代码片段(在Eclipse Indigo 3.7上测试)……诀窍是求出包的“installIU”参数的值……如果在安装程序窗口中选择所需的包时单击“more”链接,Eclipse GUI将显示这一点。
cmakeed——CMake编辑器
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
protobuf-dt -谷歌缓冲编辑器
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编辑器
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
shell - Bash脚本编辑器
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:
Pydev Pydev Pydev很棘手,因为它需要首先安装一个证书……下面的脚本可以自动完成这一步:
#!/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
#2
8
You can use the p2 director application to install Eclipse features with a script. Here are some more links that may help.
可以使用p2 director应用程序使用脚本安装Eclipse特性。下面是一些可能有帮助的链接。