简体   繁体   中英

Switch from Tycho P2 repository to Eclipse Target file

I want to switch my Eclipse Luna based Eclipse RCP project from the "P2 repository in the POM"-approach to the target file approach. (From approach 2 to approach1 in the Tycho Documentation ). This seems straightforward but it is not because I need to support multiple environments.

So in my old parent-pom I had:

<repositories>
    <repository>
        <id>eclipse platform</id>
        <url>https://my-domain/nexus/repository/eclipse_luna_repo/</url>
        <layout>p2</layout>
    </repository>
    <repository>
        <id>e4 tools</id>
        <url>https://my-domain/nexus/repository/e4_tools/</url>
        <layout>p2</layout>
    </repository>
</repositories>

and also:

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

And that was enough to define the target platform as Tycho then picks the needed dependencies defined from the different plug-in definitions.

How do I get an equivalent target file?

My attempt till now is the following (converted with the Target Platform DSL ):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="My Target" sequenceNumber="1621516437">
  <locations>
    <location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
      <unit id="org.eclipse.platform.feature.group" version="4.4.2.v20150204-1700"/>
      <unit id="org.eclipse.rcp.feature.group" version="4.4.2.v20150204-1700"/>
      <unit id="org.eclipse.jdt.feature.group" version="3.10.1.v20150204-1700"/>
      <unit id="org.eclipse.equinox.p2.discovery.feature.feature.group" version="1.0.200.v20140512-1802"/>
      <unit id="org.eclipse.equinox.executable.feature.group" version="3.6.102.v20150204-1316"/>
      <unit id="org.eclipse.ui" version="3.106.1.v20141002-1150"/>
      <unit id="org.eclipse.core.filesystem.linux.x86_64" version="1.2.200.v20140124-1940"/>
      <unit id="org.eclipse.core.filesystem.win32.x86" version="1.4.0.v20140124-1940"/>
      <unit id="org.eclipse.core.net.linux.x86_64" version="1.1.100.v20140124-2013"/>
      <unit id="org.eclipse.core.net.win32.x86" version="1.0.100.v20140124-2013"/>
      <unit id="org.eclipse.equinox.security.win32.x86" version="1.0.300.v20130327-1442"/>
      <unit id="org.eclipse.swt.gtk.linux.x86_64" version="3.103.2.v20150203-1351"/>
      <unit id="org.eclipse.swt.win32.win32.x86" version="3.103.2.v20150203-1351"/>
      <repository id="eclipse-luna" location="https://my-domain/nexus/repository/eclipse_luna_repo"/>
    </location>
    <location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
      <unit id="org.eclipse.e4.tools.compat" version="0.12.0.v20141113-1753"/>
      <unit id="org.eclipse.e4.tools.services" version="0.12.0.v20141120-0900"/>
      <repository id="e4_luna_tools" location="https://my-domain/nexus/repository/e4_tools"/>
    </location>
  </locations>
</target>

But when I build with Tycho I get the following exception:

org.eclipse.core.filesystem.linux.x86_64 1.2.200.v20140124-1940 cannot be installed in this environment because its filter is not applicable.

I think there are two solutions:

  • Using a target file for each environment
    • But this seems to be a lot of work and I have to build completely for each environment
    • At least the intermediate step works. Restricted to win32 win32 x86_64 Eclipse can start my program and Tycho can build it.
  • Put every plugin from the P2 repository in the target file and use includeMode="slicer" and includeAllPlatforms="true"
    • This seems not to work as some PowerPC dependencies can not resolved. I am not using the PowerPC architecture.

Furthermore this is probably a duplicate of this questions: Feature For Multiple OS But as it four years old and has no answers, I thought I would try again...

Instead of the platform dependent install units like org.eclipse.core.filesystem.linux.x86_64 , org.eclipse.core.filesystem.win32.x86 , etc. you should add the install unit that contains the platform dependent units as children (with platform specific filters).

For your first <location> , use the following three units instead of all the units you have (at least that's what works for me ):

<unit id="org.eclipse.equinox.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.sdk.ide" version="0.0.0"/>
<unit id="org.eclipse.jdt.feature.group" version="0.0.0"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM