Build Eclipse cross-platform with Maven Tycho
Asked Answered
H

2

7

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?

Highness answered 21/11, 2012 at 15:18 Comment(1)
This question is outdated. The described problem only occurs in Tycho 0.15.0 and earlier.Rightwards
S
7

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.

Selfaggrandizement answered 21/11, 2012 at 15:53 Comment(2)
It does not seem to be required in Tycho 0.16.0 anymore (maybe 0.15.0 already)Trinee
@msteiger: This is correct. Since Tycho 0.16.0, you no longer need to manually set the ws/os/arch attributes in the product file - the Tycho build automatically sets them for you.Rightwards
H
1

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

Hyperparathyroidism answered 15/11, 2014 at 19:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.