使用Maven构建Eclipse插件

时间:2013-11-27 06:12:34

标签: maven eclipse-plugin eclipse-rcp tycho p2

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

我已经完成了项目的几十个依赖项,并将它们部署到我们的内部Nexus(OSS)服务器。我还安装了Nexus P2 Repository插件和P2 Bridge插件(2.6.3-01)以及Nexus Unzip插件(0.12.0)。我可以浏览到我们的组存储库的.meta / p2文件夹,但它当前是空的。

这应该比目前看起来简单得多。我的目标是Windows上的Eclipse 3.4.2(Ganymede)。如果它有所不同,我们实际上将我们的应用程序部署为一个精简/定制的Eclipse安装。

蚀的存储库

当我使用<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-Names没有任何关系。

Felix Maven Bundle Plugin

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

  • mvn deploy在/nexus/content/repositories/snapshots/.meta/p2/plugins创建了一些内容。我可以通过浏览器下载jar,但所有的依赖jar都被命名为“artifact-vresion”而不是“artifact_version” - 是吗?

  • mvn bundle:bundleall为每个传递依赖项创建一个OSGI包,但我不确定如何从这里处理它们。

  • mvn bundle:deploy拒绝做任何事情,除非我指定-DremoteOBR以及其他一些我不太了解的参数。

3 个答案:

答案 0 :(得分:2)

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

另见https://bugs.eclipse.org/bugs/show_bug.cgi?id=407272

此致 保罗

答案 1 :(得分: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插件。

您应该从配置中检查您的设置,如下所示:

 <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中)帮助 - &gt;您可以检查这个安装新软件。 Eclipse应该显示提供的部分。 如果未显示任何内容,即使您已取消选中每个复选框,也应检查p2-repository。 它应包含“功能”“插件”容器以及 artifacts.jar content.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中。 有关详细信息,请查看the eclipse documentation

答案 2 :(得分:0)

你能让maven / tycho实例化一个你可以构建源插件的目标平台吗? http://www.vogella.com/articles/EclipseTycho/article.html

相关问题