eclipsemavenswttychoeclipse-rap

Tycho build with optional dependencies to SWT and RAP


I have an application with two versions: swt and rap. Therefore in my plugins I have optional dependencies on both of them and when there is missing one, the other is present and vice versa. Problem is, that in Tycho I can only require or ignore optional dependencies. Is there a way to treat this somehow?


Solution

  • well I have found a solution to this. it is having two separate profiles for rcp and rap, ignore optional dependencies and define extra requirement for each bundle I need in that particular profile eg:

    <profiles>
      <profile>
        <id>rap</id>
        <activation>
          <activeByDefault>false</activeByDefault>
          <property>
            <name>maven.profile</name>
            <value>rap</value>
          </property>
        </activation>
        <repositories>
          ...
        </repositories>
        <modules>
          ...
        </modules>
        <build>
          <plugins>
            <plugin>
              <groupId>org.eclipse.tycho</groupId>
              <artifactId>target-platform-configuration</artifactId>
              <version>${tycho-version}</version>
              <configuration>
                <dependency-resolution>
                  <optionalDependencies>ignore</optionalDependencies>
                  <extraRequirements>
                    <requirement>
                      <type>eclipse-plugin</type>
                      <id>org.eclipse.rap.ui</id>
                      <versionRange>0.0.0</versionRange>
                    </requirement>
                    <requirement>
                      <type>eclipse-plugin</type>
                      <id>org.eclipse.rap.ui.views</id>
                      <versionRange>0.0.0</versionRange>
                    </requirement>
                  </extraRequirements>
                </dependency-resolution>
              </configuration>
            </plugin>
          </plugins>
        </build>
      </profile>
    </profiles>
    

    this is what i have in top level pom.xml, if some bundle that is part of your build have optional dependecy on other bundle from that build there will be circular dependency if you add the extra requirement in the top level pom. solution is simply to add the extra requirement to pom of the bundle that has the dependency - you just have to put it inside a profile it is meant to be in