You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Eclipse RCP的p2仓库中添加Binary文件夹?

解决p2仓库未包含binary文件夹内容的问题

我是Eclipse RCP插件开发及p2仓库创建的新手,需要用到binary文件夹中的文件编译程序。当前目录包含binary、features等文件夹,已执行以下命令生成p2仓库:

java -jar /home/idefix/cots/eclipse/plugins/org.eclipse.equinox.launcher_*.jar -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher -metadataRepository file:/share/juno-test -artifactRepository file:/share/juno-test -source /share/juno-test -configs gtk.linux.x86_64,win32.win32.x86_64 -compress -publishArtifacts

但生成的content.jar和artifacts.jar中仅包含features和plugins相关内容,binary文件夹及其下的文件未被纳入,希望能将binary内容加入p2仓库。当前目录结构如下:

── artifacts.jar
├── binary
│   ├── org.eclipse.equinox.executable_root.gtk.linux.x86_64_3.8.1700.v20220509-0833
│   └── org.eclipse.equinox.executable_root.win32.win32.x86_64_3.8.1700.v20220509-0833
├── content.jar
├── features
│   ├── com_1.0.0.11042024134544.jar
│   ├── javax_1.0.0.11042024134544.jar
│   ├── org.apache_1.0.0.11042024134544.jar
│   ├── org.eclipse_1.0.0.11042024134544.jar
│   ├── org.eclipse.core_1.0.0.11042024134544.jar
│   ├── org.eclipse.e4_1.0.0.11042024134544.jar
│   ├── org.eclipse.emf_1.0.0.11042024134544.jar
│   ├── org.eclipse.equinox_1.0.0.11042024134544.jar
│   ├── org.eclipse.equinox.executable_3.8.1700.v20220509-0833.jar
│   ├── org.eclipse.jface_1.0.0.11042024134544.jar
│   ├── org.eclipse.osgi_1.0.0.11042024134544.jar
│   ├── org.eclipse.swt_1.0.0.11042024134544.jar
│   ├── org.osgi_1.0.0.11042024134544.jar
│   └── org.w3c_1.0.0.11042024134544.jar
└── plugins (I don't specify it because i have a many one)

问题原因

org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher 工具默认仅扫描并发布features和plugins目录下的内容,不会自动处理binary目录中的原生二进制包(这里是org.eclipse.equinox.executable的平台特定根文件)。

解决方案

方法1:将binary内容关联到对应feature

修改features/org.eclipse.equinox.executable_3.8.1700.v20220509-0833.jar中的feature.xml(可先解压该jar文件,修改后重新打包),添加对binary中原生包的引用:

<plugin
      id="org.eclipse.equinox.executable.root"
      os="linux"
      ws="gtk"
      arch="x86_64"
      download-size="0"
      install-size="0"
      version="3.8.1700.v20220509-0833"
      unpack="false"/>
<plugin
      id="org.eclipse.equinox.executable.root"
      os="win32"
      ws="win32"
      arch="x86_64"
      download-size="0"
      install-size="0"
      version="3.8.1700.v20220509-0833"
      unpack="false"/>

完成后重新运行你原来的发布命令,工具会通过feature的关联关系自动将binary目录下的对应文件纳入p2仓库。

方法2:单独发布binary目录内容

使用org.eclipse.equinox.p2.publisher.Publisher工具单独发布binary目录中的原生包,命令如下:

java -jar /home/idefix/cots/eclipse/plugins/org.eclipse.equinox.launcher_*.jar \
  -application org.eclipse.equinox.p2.publisher.Publisher \
  -metadataRepository file:/share/juno-test \
  -artifactRepository file:/share/juno-test \
  -source /share/juno-test/binary \
  -publishArtifacts \
  -configs gtk.linux.x86_64,win32.win32.x86_64 \
  -compress

该命令会扫描binary目录下符合命名规范的原生包,生成对应的p2元数据并添加到已有的仓库中。

注意事项

  • binary目录下的文件名需符合p2原生包命名规范:[bundle-id]_[os].[ws].[arch]_[version],你的文件名已经满足要求,可以被工具识别。
  • 执行命令时确保路径参数正确,/share/juno-test为你的p2仓库根目录,binary文件夹位于该目录下。

内容的提问来源于stack exchange,提问作者Etienne

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 09:43:21