用于构建离线“复合材料”的解决方案带有类别的 Eclipse 更新站点

发布于 2024-12-28 04:37:27 字数 1045 浏览 0 评论 0原文

这将是一个很长的问题,所以请耐心等待。我正在寻找一种解决方案来构建自定义更新站点(或 p2 存储库)以在离线开发环境中使用,并考虑以下事项:

  • 每个站点将包含第三方和自定义 Eclipse 插件的混合。

  • 我想为每个 IDE 配置创建一个站点。例如,使用Helios 的开发人员只需添加1 个包含m2e、Subversive 和CustomPluginA 的更新站点。使用 Flash Builder 的开发人员可以添加包含 m2e 和 CustomPluginB 的不同站点。

  • 由于开发处于离线状态,我们目前镜像第3方使用脚本更新站点。自定义站点需要从这些副本中提取插件。

  • 我们的自定义 Eclipse 插件目前是在 Jenkins 上使用 Maven + Tycho 构建的。如果可能的话,我想将更新站点配置为使用 Jenkins 自动构建。然后,如果更新了自定义插件,它可以触发必要的更新站点构建。

  • 更新站点中的自定义类别会很好。

我正在努力寻找最好、最干净的方法来解决这个问题。 如何使用第谷来设置类似的内容来构建网站?第谷是最好的选择吗?我是否想要将第 3 方插件复制到每个站点,或者我想要创建指向每个镜像第 3 方站点的 p2 复合存储库。是否可以使用 p2 复合存储库创建自定义类别?

最后,实际定义站点中包含哪些插件和功能的最简单方法是什么?在 Eclipse 中,我可以创建一个更新站点项目,这使得编辑变得非常容易,但我只能包含以下插件:存在于 Eclipse 安装中。手动创建 site.xml 或 p2 ant 脚本可以解决此问题,但手动确定可安装单元 ID 和版本非常困难且容易出错。

感谢您花时间阅读所有这些。如果有人能够真正解决我所有的担忧,那将是令人惊奇的,我可能不得不为这个问题增加赏金。

This is going to be a pretty long question, so bear with me. I'm looking for a solution to build custom update sites (or p2 repositories) for use in an offline development environment, with the following things in mind:

  • Each site will contain a mix of 3rd-party and custom Eclipse plugins.

  • I'd like to create a single site per IDE configuration. e.g. Developers using Helios only need to add 1 update site containing m2e, Subversive, and CustomPluginA. Developers using Flash Builder can add a different site containing m2e and CustomPluginB.

  • Since development is offline, we currently mirror 3rd-party update sites with a script. The custom sites need to draw plugins from these copies.

  • Our custom Eclipse plugins are currently built with Maven + Tycho on Jenkins. If possible, I'd like to configure the update sites to build automatically with Jenkins as well. Then, if a custom plugin is updated, it can trigger the necessary update site builds.

  • Custom categories in the update sites would be nice.

I'm trying to find the best and cleanest way to approach this. How can I set something like this up using Tycho to build the sites? Is Tycho even the best option? Do I want the 3rd-party plugins to be copied to each site, or do I want to create p2 composite repositories which point to each of the mirrored 3rd-party sites. Is it possible to create custom categories with a p2 composite repository?

And finally, what is the easiest way to actually define which plugins and features are included in a site? In Eclipse I can create an Update Site Project which makes editing very easy, but I can only include plugins which exist in that Eclipse installation. Creating a site.xml or p2 ant script by hand solves this problem, but determining installable unit IDs and versions by hand is difficult and error-prone.

Thanks for taking the time to read all this. If anyone can actually address all of my concerns that would be amazing and I'd probably have to add a bounty to this question.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愛上了 2025-01-04 04:37:27

我会建议两种方法,一种使用第谷,一种使用 B3 聚合器。

1) Tycho

第 1 步:使用 PDE 内置工具定义目标平台,该平台使用现有的本地更新站点,并将其保存为 .target 文件。然后,您可以在构建中引用此文件,如下所示:

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>target-platform-configuration</artifactId>
  <version>${tycho.version}</version> <configuration>
  <resolver>p2</resolver>
   <target>
     <artifact>
      <groupId>org.eclipse.viatra2</groupId>
      <artifactId>«project name where the target file resides»</artifactId>
      <version>«artifact version»</version>
      <classifier>«target filename without extension»</classifier>
     </artifact>
   </target>
   <ignoreTychoRepositories>true</ignoreTychoRepositories>
  </configuration>
 </plugin>

步骤 2:将新项目定义为更新站点。该项目应包含一个category.xml,引用上一步中目标平台的已使用功能的已使用版本。您可以使用 PDE 类别定义向导/编辑器创建此category.xml。

步骤 3:只需使用更新站点原型发布您的构建:

<packaging>eclipse-repository</packaging>
<build>
  <plugins>
    <plugin>
      <groupId>org.eclipse.tycho</groupId>
      <artifactId>tycho-p2-publisher-plugin</artifactId>
      <version>${tycho.version}</version>
      <configuration>
        <publishArtifacts>true</publishArtifacts>
      </configuration>
    </plugin>
  </plugins>
</build>

2) B3 聚合器:

Eclipse B3 项目包含一个 聚合器功能。使用聚合器,您可以定义一个使用现有更新站点的模型,然后只需使用聚合器执行该模型,结果就是一个更新站点。在后一种情况下,您可以构建引用其他更新站点的复合更新站点,也可以从原始数据创建独立副本。手册包含一个简单的示例,很容易使用。

3) 比较

在 B3 中定义镜像逻辑更加简单,因为模型仅包含镜像描述,并且还允许创建仅引用现有站点的复合更新站点。然而,如果你除了更新网站建设之外还想做其他事情,那就更难了。此外,它可以在无头构建中执行(例如从 Jenkins),但需要安装无头 Eclipse 实例。该文档包含详细信息,但该工具不像 Maven/Tycho 那样是独立的。

在 Tycho 的情况下,很难看到生成的更新站点的结构,但是,生成的构建更具可扩展性(例如,您可以使用相同类型的构建简单地添加自己的功能),并且要进行构建,您只需要已安装 Maven。

总而言之,这两种工具可能都适合您的需求 - 您需要根据您的情况评估它们的优点和缺点。

I will suggest two ways, one with Tycho and one with the B3 aggregator.

1) Tycho:

Step 1.: Define a target platform using PDE built-in tools, that uses your existing local update sites, and save it as a .target file. Then you can reference this file in your build like the following:

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>target-platform-configuration</artifactId>
  <version>${tycho.version}</version> <configuration>
  <resolver>p2</resolver>
   <target>
     <artifact>
      <groupId>org.eclipse.viatra2</groupId>
      <artifactId>«project name where the target file resides»</artifactId>
      <version>«artifact version»</version>
      <classifier>«target filename without extension»</classifier>
     </artifact>
   </target>
   <ignoreTychoRepositories>true</ignoreTychoRepositories>
  </configuration>
 </plugin>

Step 2.: Define a new project as an update site. The project should contain a category.xml referring the used versions of the used features of the target platform from the previous step. You can create this category.xml using the PDE Category definition wizard/editor.

Step 3.: Simply publish your build using the update site archetype:

<packaging>eclipse-repository</packaging>
<build>
  <plugins>
    <plugin>
      <groupId>org.eclipse.tycho</groupId>
      <artifactId>tycho-p2-publisher-plugin</artifactId>
      <version>${tycho.version}</version>
      <configuration>
        <publishArtifacts>true</publishArtifacts>
      </configuration>
    </plugin>
  </plugins>
</build>

2) B3 Aggregator:

The Eclipse B3 project contains an aggregator feature. Using the Aggregator you define a model which uses existing update sites, then simply execute this model using the Aggregator, and the result is an update site. In the latter case you can either build a composite update site, that refers to other update sites, or you can create a standalone copy from the original data. The manual contains a simple example, it is easy to use.

3) Comparison

Defining the mirroring logic is more straightforward in B3, as the model contains only the mirroring description, and also allows the creation of composite update sites that only reference the existing sites. However, if you want to do anything else besides update site building, then it is harder to do. Additionally, it can be executed in headless builds (e.g. from Jenkins), but it needs an installation of a headless Eclipse instance. The documentation contains the details, but the tool is not standalone like in case of Maven/Tycho.

In case of Tycho it is harder to see the structure of the resulting update site, however, the resulting build is more extensible (e.g. you can simply add your own features using the same kind of build), and to do a build you only need Maven installed.

So alltogether, both tools might fit your needs - you need to evaluate their strengths and weaknesses in you case.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文