使用Maven构建Eclipse插件

10

我正在尝试配置Maven构建一个Eclipse应用程序(带有所有Eclipse EXE等打包的Eclipse插件)。

我已经使用Maven对项目的几十个依赖项进行了管理,并将它们部署到我们的内部Nexus(OSS)服务器。我还安装了Nexus P2存储库插件、P2桥接插件(2.6.3-01)和Nexus解压缩插件(0.12.0)。我可以浏览到我们组存储库的.meta/p2文件夹,但它目前为空。

这应该比它目前显示的要简单得多。我瞄准的是Windows上的Eclipse 3.4.2(Ganymede)。如果有任何区别,我们实际上是将我们的应用程序打包成了一个精简/定制的Eclipse安装包。

eclipse-repository

当我针对包含<packaging>eclipse-repository</packaging>的pom运行maven时,我会收到以下错误:

[ERROR]   Missing requirement: MyApp 0.0.0 requires 
          'org.eclipse.equinox.executable.feature.group 0.0.0' 
          but it could not be found

我该从哪里获取它,如何将其添加到Nexus中?

当我针对包含 <packaging>eclipse-plugin</packaging> 的pom运行maven时,会出现以下错误:

[ERROR]   Missing requirement: MyApp 0.0.0 requires 
          'bundle org.eclipse.ui 0.0.0'
          but it could not be found

但我在本地文件系统中发现了以下目录(怀疑 itp-04-rcp 生成了第一个目录):

D:\maven\repository\p2\osgi\bundle\org.eclipse.ui\3.6.2.M20110203-1100
D:\maven\repository\p2\osgi\bundle\org.eclipse.ui\3.7.0.v20110928-1505

Tycho POM-First artifacts

我还尝试了pom-first-dependencies和manifest-first-dependency的组合:http://wiki.eclipse.org/Tycho/How_Tos/Dependency_on_pom-first_artifacts

我不明白这是如何工作的-我可以从Git构建itp02。我可以看到它构建了两个捆绑:

+---------------------+---------------------+--------------------------------------+
| artifactId          | Bundle-Name         | Bundle-SymbolicName                  |
+---------------------+---------------------+--------------------------------------+
| pomfirst-bundle     | pomfirst-bundle     | tycho.demo.itp02.pomfirst-bundle     |
| pomfirst-thirdparty | pomfirst-thirdparty | tycho.demo.itp02.pomfirst-thirdparty |
+---------------------+---------------------+--------------------------------------+

...但 build02 如何获取这些信息呢?唯一相关的部分似乎是:

Import-Package: tycho.demo.itp02.pomfirst

...这与任何一个Bundle名称都没有关系。

Felix Maven Bundle插件

我尝试了Felix maven-bundle-plugin。我使用<packaging>bundle</packaging>在pom中包含了所有常规的maven依赖项。

  • mvn deploy会在/nexus/content/repositories/snapshots/.meta/p2/plugins路径下创建一个文件。我可以通过浏览器下载JAR包,但所有依赖的JAR文件名都是"artifact-vresion"而不是"artifact_version" - 这样做对吗?

  • mvn bundle:bundleall为每个传递依赖项创建一个OSGI Bundle,但我不确定从这里要怎么做。

  • mvn bundle:deploy拒绝执行任何操作,除非我指定-DremoteOBR和可能还有其他几个我不太理解的参数。


你有具体的问题吗?看起来你想得到一个“如何开发插件”的完整解决方案。这样的问题不适合在stackoverflow上提问,因为它需要像博客文章一样长的答案。 - oberlies
@oberlies - 我只是想要一个可行的解决方案 - 如何在我们的Nexus仓库中使用Maven构件来构建RCP应用程序? - Nicholas Albion
1
问题在于这方面的文档分散在数十个页面/博客/维基上,有各种方法和许多方面,我不知道如何验证每个部分是否正常工作。RCP应用程序将需要来自Nexus存储库“Internal”、“Snapshots”和其他代理存储库的构件 - 我是否配置P2功能以指向“Public”组存储库?“重建P2 repo/manifest”任务呢 - 使用哪个组和路径?我怎么知道它实际上做了什么? - Nicholas Albion
3个回答

3

如果您构建包含本地启动器的 Eclipse 产品(在产品配置中将“包括启动器”属性设置为 true),则似乎需要 'org.eclipse.equinox.executable.feature.group'。尝试将该功能添加到平台定义中(例如,从 Eclipse p2 存储库或正在运行的 Eclipse IDE 中复制)。

另请参阅https://bugs.eclipse.org/bugs/show_bug.cgi?id=407272

敬礼, Paolo


我的Eclipse(Indigo 3.7.2)有“org.eclipse.equinox.launcher_1.2.0.v20110502.jar”和一个文件夹“org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502”。目标版本的Eclipse有“org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar”和一个文件夹“org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731”。 - Nicholas Albion

2
为了解决有关缺少依赖项的问题:
[ERROR]   Missing requirement: MyApp 0.0.0 requires 
          'bundle org.eclipse.ui 0.0.0'
          but it could not be found

看起来你的功能/插件MyApp需要在安装前下载org.eclipse.ui插件。

你应该检查你的配置pom文件中的设置,像这样:

 <properties>
  <tycho.version>0.25.0</tycho.version>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <repository.url>http://download.eclipse.org/releases/neon</repository.url>
 </properties>

 <repositories>
  <repository>
   <id>NeonRepository</id>
   <url>${repository.url}</url>
   <layout>p2</layout>
  </repository>

如果您已经设置了自己托管的p2存储库,请确保页面正确构建。您可以在Eclipse中选择(帮助->安装新软件)来检查此内容。Eclipse应该会显示提供的部分。如果没有显示任何内容,即使您已取消选中每个复选框,您也应该检查您的p2存储库。它应该包含"features""plugins"容器以及artifacts.jarcontent.jar。如果您只有这两个文件夹,则应运行

eclipse -application org.eclipse.equinox.p2.publisher.UpdateSitePublisher
 -metadataRepository file:/<some location>/repository
 -artifactRepository file:/<some location>/repository
 -source /<location with a site.xml>
 -configs gtk.linux.x86
 -compress
 -publishArtifacts

在CLI/Shell中进行操作。欲了解更多信息,请查看Eclipse文档


0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接