如何使用命令行自动安装Eclipse插件?

时间:2011-08-23 16:00:17

标签: linux eclipse command-line

我需要自动安装Eclipse Classic并添加两个“插件”:

  • CDT(不确定这可称为“插件”)
  • 的PyDev

安装Eclipse Classic(刚刚下载):

sudo tar -xvzf eclipse-SDK-3.7-linux-gtk.tar.gz -C /usr/local/

如何安装CDT和PyDev作为系统插件(不是用户)?

3 个答案:

答案 0 :(得分:18)

我可以找到这两个有帮助的文档:

安装刚下载的Eclipse Classic:

sudo tar -xvzf eclipse-SDK-3.7-linux-gtk.tar.gz -C /usr/local/

安装所需的CDT功能(使用Eclipse的“帮助>安装新软件”工具找到的参考资料)

  • C / C ++开发工具(org.eclipse.cdt.feature.group)
  • C / C ++开发工具SDK(org.eclipse.cdt.sdk.feature.group)
  • C / C ++开发平台(org.eclipse.cdt.platform.feature.group)
  • C / C ++内存视图增强功能(org.eclipse.cdt.debug.ui.memory.feature.group)
  • 适用于C / C ++的Eclipse调试器(org.eclipse.cdt.debug.edc.feature.group)
  • 其他C / C ++实用程序(org.eclipse.cdt.util.feature.group)

运行:

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

要安装PyDev,我们首先需要插入他们的自动签名证书(可在此处找到: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"

所以运行它:

sudo ./add_pydev_certificate.py

所需的PyDev功能是:

  • PyDev for Eclipse(org.python.pydev.feature.feature.group)

运行:

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

答案 1 :(得分:2)

这是一个迟到的答案,但您可能想要检查将存储库的功能和插件目录复制到位于主eclipse文件夹下的名为dropins的文件夹。这适用于Helios及更高版本。有关详细信息,请访问this link

答案 2 :(得分:1)

您可以从GUI手动将CDT和PyDev添加到当前的Eclipse安装中。 然后将它们完全打包成一个存档和放大器。解压缩目标系统。