Build Eclipse cross-platform with Maven Tycho

折月煮酒 提交于 2019-12-06 01:41:45

问题


I try to compile an Eclipse Indigo RCP application with Maven and Tycho. It works fine if I just build it for one platform but if I try to build it for more the build stops working.

The Problem is that I have platform specific plugins in my product file I want to build. Dependencies like org.eclipse.swt.win32.win32.x86 which are fragment plugins for org.eclipse.swt.
When I add no platform specific fragments to my product the application wouldn't start because there are no platform libraries like org.eclipse.swt.win32.win32.x86. As Tycho repository we use a clone of the eclipse indigo update site hosted on our own server. It includes the delta-pack. And when I add all fragments for all platforms the build crashed and maven tell me that the platform filters did not match for the Linux build for example.

Does anyone know how to fix this?
Should I add these platform dependent stuff into my product? I prefer to keep the specific dependencies out of my product, am I right?


回答1:


It sounds like you have a plug-in based product. In this case you will need to manually edit your .product file and add in platform filters for these plug-ins. Unfortunately the built-in product editor in eclipse does not expose these values. See http://wiki.eclipse.org/Tycho/FAQ#How_to_build_plugin-based_products_with_platform-specific_fragments.3F

For each plugin e.g. org.eclipse.swt.win32.win32.x86 you will need to add something like;

<plugin id="org.eclipse.swt.win32.win32.x86" fragment="true" ws="win32" os="win32" arch="x86"/>

Note, if you use the product editor it will remove these values.

It is better however to use a feature based product. The feature editor permits these fields to be edited.




回答2:


There is an easier solution I found in the blog: http://blog.sdruskat.net/building-a-cross-platform-feature-based-eclipse-rcp-product-with-tycho-the-umpteenth/

In the parent/master pom.xml, To use all the plugins from p2, specify the following:

<build>
 <plugins>
  <plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-maven-plugin</artifactId>
    <version>${tycho-version}</version>
    <extensions>true</extensions>
  </plugin>

  <plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>target-platform-configuration</artifactId>
    <version>${tycho-version}</version>
    <configuration>
       <resolver>p2</resolver>
        <environments>
          <environment>
            <os>linux</os>
            <ws>gtk</ws>
            <arch>x86_64</arch>
          </environment>
          <environment>
            <os>win32</os>
            <ws>win32</ws>
            <arch>x86_64</arch>
          </environment>
        </environments>
    </configuration>
  </plugin>
 </plugins>
</build>

My tycho version is 0.21.0



来源:https://stackoverflow.com/questions/13496321/build-eclipse-cross-platform-with-maven-tycho

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!