【问题标题】:How do you automate the installation of Eclipse plugins with command line?如何使用命令行自动安装 Eclipse 插件?
【发布时间】:2014-08-01 05:37:11
【问题描述】:

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

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

安装 Eclipse Classic(刚刚下载):

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

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

【问题讨论】:

    标签: linux eclipse command-line


    【解决方案1】:

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

    安装新下载的 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 功能是:

    • Eclipse 的 PyDev (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
    

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        【解决方案3】:

        您可以从 GUI 手动将 CDT 和 PyDev 添加到当前的 Eclipse 安装中。 然后将它们全部打包到一个存档中并在目标系统上解压。

        【讨论】:

        • 好主意。我一直在寻找真正的可编写脚本的方法,可以部分使用(例如仅 CDT)或稍后通过添加另一个 Eclipse 功能来扩展。
        猜你喜欢
        • 2012-07-22
        • 2021-06-10
        • 2014-07-19
        • 1970-01-01
        • 2016-04-18
        • 2015-10-11
        • 1970-01-01
        • 2016-01-29
        • 1970-01-01
        相关资源
        最近更新 更多