Yes, by 'derived' I meant: maven
parent-child relationship.
So, the overall parent pom "pom.xml" looks like:
<groupId>com.XXX.XXXX.shared</groupId>
<artifactId>shared-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
...
<dependency-resolution>
<optionalDependencies>ignore</optionalDependencies>
....
whereas the test fragment's parent pom is defined as a child of
parent pom
<artifactId>shared-parent.test</artifactId>
<groupId>com.XXX.XXX.shared.test</groupId>
<parent>
<groupId>com.entimice.maven.shared</groupId>
<artifactId>shared-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
<relativePath><PATHTOPARENTPOM></relativePath>
</parent>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
<dependency-resolution>
<!-- http://dev.eclipse.org/mhonarc/lists/tycho-user/msg03464.html -->
<!-- <extraRequirements> lists all the optional bundles that must be
on the compile classpath. -->
<extraRequirements combine.children="append">
<!-- logging fragment to provide logging.properties in classpath root -->
<requirement>
<type>eclipse-plugin</type>
<id>com.XXX.tst.common.logging</id>
<versionRange>0.0.0</versionRange>
</requirement>
...
The overall parent pom denies all optional dependencies by default
but with extraRequirements you can add those dependencies that you
need at runtime. In this example we add a special logging fragment
to the test runtime that would not be resolved otherwise. The
combine.children="append" appends to possible entries in overall
parent pom instead of overwriting.
So, eventually you end up with a test fragment's pom.xml which
defines the "test parent pom" as parent.
<groupId>com.entimice</groupId>
<artifactId>com.XXX.XXX</artifactId>
<packaging>eclipse-test-plugin</packaging>
<parent>
<groupId>com.XXX.XXX.shared.test</groupId>
<artifactId>shared-parent.test</artifactId>
<version>2.0.0-SNAPSHOT</version>
<relativePath><PATHTOTESTPARENTPOM></relativePath>
</parent>
</project>
Now any OSGI test runtime will be constructed from transitive
dependencies of test fragment + extra requirements only.
This approach has been used in our project for quite some time and
also other contexts (RCP/RAP).
Hope this helps.
Kind regards
Henrik
Am 04.03.2016 um 15:54 schrieb Justin Dolezy: