如何从脚本安装eclipse插件列表?

hea*_*bar 19 eclipse eclipse-plugin eclipse-cdt

我需要一种方法来从linux中的脚本以完全无人值守的方式设置高度自定义的eclipse编码环境.定制的eclipse环境需要安装来自各种来源的大约10种不同的插件(protobuf,pydev,cmakeed,openinterminal,egit,yaml,webpageeditor等).每次使用gui手动执行此操作需要20-30分钟.我想在脚本中自动安装插件,这样任何运行linux的人都可以使用一组自定义插件重新创建我的eclipse环境,而无需人工干预.任何人都有关于如何做到这一点的建议?

hea*_*bar 20

以下是安装我最喜欢的一些插件的命令行片段(在Eclipse Indigo 3.7上测试)...诀窍是弄清楚包的"installIU"参数的值... 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
Run Code Online (Sandbox Code Playgroud)

OpenInTerminal - 在上下文菜单中添加选项

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
Run Code Online (Sandbox Code Playgroud)

protobuf-dt - Google Protobuffer编辑器

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
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

炮轰 - 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
Run Code Online (Sandbox Code Playgroud)

网页编辑器

eclipse -nosplash -application org.eclipse.equinox.p2.director -repository http://download.eclipse.org/releases/indigo/ -installIU org.eclipse.jst.webpageeditor.feature.feature.group
Run Code Online (Sandbox Code Playgroud)

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()
Run Code Online (Sandbox Code Playgroud)

然后你可以运行:

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
Run Code Online (Sandbox Code Playgroud)


gam*_*son 8

您可以使用p2 director应用程序通过脚本安装Eclipse功能.这里有一些更多的 链接,可以帮助.