Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Cannot use JavaSE1.8 from test plugin

hm. If you are happy with your previous workaround, keep it.
If not we'd need a sample project that reproduces the issue to be able to
analyse it.

Regards
Jan

On 11/08/15 14:11, "tycho-user-bounces@xxxxxxxxxxx on behalf of Robert
Kiss" <tycho-user-bounces@xxxxxxxxxxx on behalf of robert.kiss@xxxxxxxxx>
wrote:

>Hello Jan
>
>
>I tried to do that, keep 1.8 in both classpath and MANIFEST.MF of the
>plugin and only use
><executionEnvironment>JavaSE-1.6</executionEnvironment> in
>target-platform-configuration but now it fails with the following message:
>
>[INFO] Resolving class path of MavenProject:
>com.movidius.myriad:com.movidius.systests:1.0.0-SNAPSHOT @
>C:\WS\trunk\trunkEclipse\systests\plugins\com.movidius.systests\pom.xml
>[ERROR] Internal error: java.lang.RuntimeException:
>org.osgi.framework.BundleException: Bundle com.movidius.systests cannot
>be resolved
>[ERROR] Resolution errors:
>[ERROR] Bundle com.movidius.systests - Missing Constraint:
>Bundle-RequiredExecutionEnvironment: JavaSE-1.8
>[ERROR] -> [Help 1]
>org.apache.maven.InternalErrorException: Internal error:
>java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle
>com.movidius.systests cannot be resolved
>Resolution errors:
>   Bundle com.movidius.systests - Missing Constraint:
>Bundle-RequiredExecutionEnvironment: JavaSE-1.8
>
>
>Regards
>
>Robert
>
>
>
>
>
>On Tue, Aug 11, 2015 at 2:55 PM, Sievers, Jan
><jan.sievers@xxxxxxx> wrote:
>
>I think you can simply keep the JavaSE-1.8 BREE in the manifest and
>configure
>
>target-platform-configuration with
><executionEnvironment>JavaSE-1.6</executionEnvironment>
>
>as well as tycho-compiler-plugin source and target [1] set to 1.8 in
>pom.xml (or <useProjectSettings>true</useProjectSettings>).
>
>to work around the bug mentioned. No need to change .classpath which is a
>derived file I think.
>
>The point is if you really want to use JavaSE-1.8 at runtime and compile
>time, we should restrict the workaround to only affect Tycho/p2 dependency
>resolution via pom.xml as this is where the bug is.
>
>Jan
>
>[1]
>https://eclipse.org/tycho/sitedocs/tycho-compiler-plugin/compile-mojo.html
>#
>source
>
>
>On 11/08/15 12:00, "tycho-user-bounces@xxxxxxxxxxx on behalf of Robert
>Kiss" <tycho-user-bounces@xxxxxxxxxxx on behalf of
>robert.kiss@xxxxxxxxx>
>wrote:
>
>>Thank you Jan for your hint.
>>
>>
>>I manage to make it work with a quite strange setup. For reference here
>>is what I did:
>>
>>
>>Inside my test plugin I have:
>>
>> - .classpath uses JavaSE-1.8 so from IDE I'm able to write and compile
>>Java 8 code
>>
>> - MANIFEST.MF specify as BREE JavaSE-1.6 so Tycho will allow to install
>>the plugin in a 1.6 compliant environment. Because this is a test plugin
>>and we don't deliver this plugin this setting, albeit wrong, is
>>acceptable for us.
>>
>>
>>
>>Tycho compiler is configured with
>><useProjectSettings>true</useProjectSettings>. I assume if that would be
>>false I would need also an jre.compilation.profile=JavaSE-1.8 inside the
>>build.properties of my plugin.
>>
>>
>>
>>Inside the pom.xml we configure target-platform-configuration with
>><executionEnvironment>JavaSE-1.6</executionEnvironment>. Of course Tycho
>>is executed with JavaSE-1.8
>>
>>
>>
>>Regards
>>
>>Robert
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>On Tue, Aug 11, 2015 at 11:55 AM, Sievers, Jan
>><jan.sievers@xxxxxxx> wrote:
>>
>>the p2 product publisher hardcodes a dependency to bogus IU a.jre.javase
>>[1.6.0]
>>
>>https://bugs.eclipse.org/bugs/show_bug.cgi?id=387701
>>
>>
>>To make it happy, you could try
>>
>>- using JavaSE-1.6 as BREE in the test bundle (as you mentioned)
>>- overriding the execution environment of the test bundle using one of
>>the
>>methods in
>>
>>https://wiki.eclipse.org/Tycho/Execution_Environments#Execution_environme
>>n
>>t
>>_configuration
>>
>>
>>Regards
>>Jan
>>
>>
>>On 11/08/15 10:24, "tycho-user-bounces@xxxxxxxxxxx on behalf of Robert
>>Kiss" <tycho-user-bounces@xxxxxxxxxxx on behalf of
>>robert.kiss@xxxxxxxxx>
>>wrote:
>>
>>>Hello all
>>>
>>>
>>>I have a test plugin which contain "UI system tests" so as a result it
>>>requires the entire product to run the tests.
>>>
>>>The pom.xml have the following content (partially)
>>>
>>>
>>>    <groupId>com.sample</groupId>
>>>    <artifactId>com.sample.systests</artifactId>
>>>    <packaging>eclipse-test-plugin</packaging>
>>>
>>><build>
>>>            <plugin>
>>>                <groupId>org.eclipse.tycho</groupId>
>>>                <artifactId>target-platform-configuration</artifactId>
>>>                <version>${tycho.version}</version>
>>>                <configuration>
>>>                    <dependency-resolution>
>>>                        <extraRequirements>
>>>                            <!-- add dependency to product IU under test
>>>-->
>>>                            <requirement>
>>>                                <type>p2-installable-unit</type>
>>>                                <id>MyProduct</id>
>>>                                <versionRange>0.0.0</versionRange>
>>>                            </requirement>
>>>                        </extraRequirements>
>>>                    </dependency-resolution>
>>>                </configuration>
>>>            </plugin>
>>>        </plugins>
>>>    </build>
>>>
>>>
>>>Tests run as expected when JavaSE1.6 is referenced from plugin's
>>>MANIFEST.MF and .classpath however when JavaSE 1.7 or 1.8 is used the
>>>build fails with the following message:
>>>
>>>[INFO] Installing IUs [com.movidius.systests,
>>>org.eclipse.tycho.surefire.osgibooter,
>>>org.eclipse.tycho.surefire.junit4,
>>>MyProduct] to
>>>C:\WS\trunk\trunkEclipse\systests\plugins\com.sample.systests\target\wor
>>>k
>>>Installing com.sample.systests 1.0.0.201508110757.
>>>Installing org.eclipse.tycho.surefire.osgibooter 0.23.1.
>>>Installing org.eclipse.tycho.surefire.junit4 0.23.1.
>>>Installing MyProduct 1.0.0.201508110757.
>>>Installation failed.
>>>Cannot complete the install because one or more required items could not
>>>be found.
>>> Software being installed: MyProductProduct 1.0.0.201508110757
>>>(MyProduct
>>>1.0.0.201508110757)
>>> Missing requirement: MyProductProduct 1.0.0.201508110757 (MyProduct
>>>1.0.0.201508110757) requires 'a.jre.javase [1.6.0]' but it could not be
>>>found
>>>
>>>
>>>I have other test plugins which does not use
>>><type>p2-installable-unit</type> and are marked with JavaSE1.8 and they
>>>run correctly.
>>>
>>>
>>>My product definition have the following content:
>>>
>>>      <feature id="org.eclipse.rcp"/>
>>>      <feature id="org.eclipse.rcp.configuration"/>
>>>      <feature id="org.eclipse.platform"/>
>>>      <feature id="org.eclipse.equinox.p2.user.ui"/>
>>>....
>>>
>>>
>>>I suspect a bug in Tycho but maybe not...
>>>
>>>Any advice?
>>>
>>>
>>>Regards
>>>
>>>Robert Kiss
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>_______________________________________________
>>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
>
>
>
>
>
>
>



Back to the top