Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Catch-22 with useUIHarness and excluding org.eclipse.ui.ide ?

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:
Thanks Henrik, this sounds like exactly what I need.

Could you expand a little on what you mean by a "derived parent pom"? This is like having it as a child of the main product pom?

Best regards,
Justin

On 4 Mar 2016, at 13:16, Henrik Steudel <hst@xxxxxxxxx> wrote:

Hi,
If your unwanted dependency is an optional dependency, would it help to disable optional dependencies in target-platform-configuration?

<plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <configuration>
                    <dependency-resolution>
                        <optionalDependencies>ignore</optionalDependencies>
....

Tycho-surefire won't pick up org.eclipse.ui.ide then. If you need specific optional dependencies, these can be declared separately in same plugin like

<extraRequirements>
                            <requirement>
                                <type>eclipse-plugin</type>
                                <id>org.eclipse.swt</id>
                                <versionRange>0.0.0</versionRange>
                            </requirement>

We ignore optional dependencies in parent pom. Then we defined a derived parent pom for test fragments which then adds optional/fragment bundles for tests via extraRequirements again.

Kind regards
Henrik

Am 04.03.2016 um 13:16 schrieb Justin Dolezy:
Thanks for that Tom, however doesn’t seem to work for me. It complains the feature could not be found, unsurprising as the reactor order didn’t changed and the feature is the second to last module, before the actual product..

It’s also listing unsatisfied dependencies from o.e.ui.ide.application, o.e.compare, etc to o.e.ui.ide which is suspicious as I’d have thought it shouldn’t start the IDE workbench when configured with my product & application.

I came across this old StackOverflow post which is pretty much what I want to do but presumably the problem still exists?


Clutching at straws I also tried adding o.e.ui.ide via <dependencies> instead to try to override the target platform filter, but unsurprisingly didn’t work either as it can’t add in what it no longer knows about.

Seems like I’ll need to post-process the build output to remove o.e.ui.ide, not pretty!

Regards,
Justin

On 4 Mar 2016, at 01:00, Tom Bryan (tombry) <tombry@xxxxxxxxx> wrote:

On 3/3/16, 7:50 PM, "tycho-user-bounces@xxxxxxxxxxx on behalf of Justin Dolezy" <tycho-user-bounces@xxxxxxxxxxx on behalf of justin.dolezy@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

The tycho-surefire docs indicate it’s possible to run a different application/product to the IDE workbench but I can’t find any concrete examples. Running my own product to host the tests would be another potential catch 22 although easily resolved by running the test fragments at the end of the reactor I suppose.

Just to answer this part, you can specify the application and product as part of the Mojo's configuration: https://eclipse.org/tycho/sitedocs/tycho-surefire/tycho-surefire-plugin/test-mojo.html

We do something like this, 

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<testSuite>com.foo.bar.tests</testSuite>
<testClass>${testSuite}</testClass>
<includes>
<include>**/*Test.java</include>
</includes>
<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>
<product>com.foo.product</product>
<application>com.foo.application</application>
<dependencies>
<dependency>
<type>p2-installable-unit</type>
<artifactId>com.foo.feature</artifactId>
<version>0.0.0</version>
</dependency>
</dependencies>
</configuration>
</plugin>

_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user



_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user


-- 
Entimo AG
Stralauer Platz 33 - 34 | 10243 Berlin | Germany
Tel: +49.30.52 00 24 133 | Fax: +49.30.52 00 24 101
hst@xxxxxxxxxx | http://www.entimo.com/

Vorstand: Jürgen Spieler (Vors.), Marianne Neumann
Aufsichtratsvorsitzender: Erika Tannenbaum

Sitz der Gesellschaft: Berlin, Germany | Handelsregister: HRB Berlin-Charlottenburg 85073
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user



_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user


-- 
Entimo AG
Stralauer Platz 33 - 34 | 10243 Berlin | Germany
Tel: +49.30.52 00 24 133 | Fax: +49.30.52 00 24 101
hst@xxxxxxxxxx | http://www.entimo.com/

Vorstand: Jürgen Spieler (Vors.), Marianne Neumann
Aufsichtratsvorsitzender: Erika Tannenbaum

Sitz der Gesellschaft: Berlin, Germany | Handelsregister: HRB Berlin-Charlottenburg 85073

Back to the top