Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Java 11 + Tycho-Surefire + bundled OpenJFX11
Java 11 + Tycho-Surefire + bundled OpenJFX11 [message #1828277] Fri, 05 June 2020 13:16 Go to next message
Shawn Kleese is currently offline Shawn KleeseFriend
Messages: 1
Registered: June 2020
Junior Member
Hello everybody,

i'm struggeling really hard with the migration of our project from Java 8 to Java 11.

One of the biggest Issues are the UI tests with Tycho-Surefire. I've thinked that the frameworkExtension "org.eclipse.fx.osgi" registers the JavaFx Bundles/Modules and everything is fine - but its changes nothing...

<frameworkExtension>
<groupId>org.eclipse.fx</groupId>
 <artifactId>org.eclipse.fx.osgi</artifactId>
<version>3.7</version>
</frameworkExtension>


I have added the rebundled JavaFX11 Bundles from Bestsolution to my target: downloads.efxclipse.bestsolution.at/p2-repos/openjfx-11/repository/

The only way i've found that this works is when i use "--module-path [path to javafx-sdk-11.0.2]" and alot of "--add-modules ... --add-exports ... --add-opens"-Parameters. Second is not the Problem but i don't want to have everywhere(devlopers and Jenkins,etc.) a javafx-SDK installed at the same path. This seems to be the wrong way for me...

Here is my POM for example:
<properties>
		<test.cmdline.base>-Dorg.osgi.framework.bundle.parent=ext -Dosgi.framework.extensions=org.eclipse.fx.osgi -Dfile.encoding=UTF-8 -Dprism.order=d3d</test.cmdline.base>
		
		<test.cmdline.jigsaw.modulepath>--module-path "C:\Program Files\Java\javafx-sdk-11.0.2\lib" </test.cmdline.jigsaw.modulepath>
		<test.cmdline.jigsaw.modules>--add-modules javafx.base,javafx.controls,javafx.graphics,javafx.fxml,javafx.web</test.cmdline.jigsaw.modules>
		<test.cmdline.jigsaw.exports>--add-exports javafx.base/com.sun.javafx.beans=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.css=ALL-UNNAMED --add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED --add-exports=javafx.graphics/com.sun.glass.ui=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.scene.traversal=ALL-UNNAMED --add-opens=javafx.graphics/com.sun.javafx.text=ALL-UNNAMED</test.cmdline.jigsaw.exports>
		<test.cmdline.jigsaw.opens>--add-opens=javafx.graphics/javafx.scene=ALL-UNNAMED --add-opens=javafx.graphics/javafx.application=ALL-UNNAMED --add-opens=javafx.graphics/javafx.scene.text=ALL-UNNAMED</test.cmdline.jigsaw.opens>

		<test.cmdline.arguments>${test.cmdline.base} ${test.cmdline.jigsaw.modulepath} ${test.cmdline.jigsaw.modules} ${test.cmdline.jigsaw.exports} ${test.cmdline.jigsaw.opens}</test.cmdline.arguments>
	
		<test.app.argline>-nosplash -consoleLog -console</test.app.argline>
	       <tycho.version>1.7.0</tycho.version>
	</properties>

	<modules>
		<module>de.cooltests.module.A</module>
		<module>de.cooltests.module.C</module>
		<module>de.cooltests.module.C</module>
	</modules>

	<build>
		<plugins>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-surefire-plugin</artifactId>
				<version>${tycho.version}</version>
				<configuration>
				 	<argLine>${test.cmdline.arguments}</argLine> <!-- maybe neded for monocle:   - - add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED  - - illegal-access=permit - - add-modules javafx.fxml,javafx.graphics - - add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED  - -add-modules javafx.graphics - -add-reads javafx.graphics=ALL-UNNAMED      -Dtestfx.robot=glass -Dglass.platform=Monocle -Dmonocle.platform=Headless -Dprism.order=sw     - -    add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED-->
				 	<!-- sooo many params  -Djava.awt.headless=true -Dtestfx.headless=true -Dtestfx.robot=glass -Dmonocle.platform=Headless -Dprism.order=d3d -Dprism.text=t2k -Dprism.verbose=true -Dtestfx.setup.timeout=2500 -   -   add-opens de.truncated.framework.shared/de.truncated.framework.shared.resources=ALL-UNNAMED -->
					<appArgLine>${test.app.argline}</appArgLine>
					<forkCount>0</forkCount>
					<useUIHarness>false</useUIHarness>
	                  <frameworkExtensions>
						 <frameworkExtension>
							<groupId>org.eclipse.fx</groupId>
						    <artifactId>org.eclipse.fx.osgi</artifactId>
						    <version>3.7</version>
						 </frameworkExtension>
					 </frameworkExtensions>
				</configuration>
			</plugin>
		
			<plugin>
			   <groupId>org.eclipse.tycho</groupId>
			   <artifactId>target-platform-configuration</artifactId>
			   <version>${tycho.version}</version>
			   <configuration>
<target>
						<artifact>
							<groupId>de.cooltests</groupId>
							<artifactId>de.cooltests.target</artifactId>
							<version>${project.version}</version>
						</artifact>
					</target>
environments>
						<environment>
							<os>win32</os>
							<ws>win32</ws>
							<arch>x86_64</arch>
						</environment>
					</environments>
			      <dependency-resolution>
			         <extraRequirements>
			          <requirement>
			               <type>p2-installable-unit</type>
			               <id>openjfx.base</id>
			               <versionRange>0.0.0</versionRange>
			            </requirement>
			            <requirement>
			               <type>p2-installable-unit</type>
			               <id>openjfx.controls</id>
			               <versionRange>0.0.0</versionRange>
			            </requirement>
			            <requirement>
			               <type>p2-installable-unit</type>
			               <id>openjfx.fxml</id>
			               <versionRange>0.0.0</versionRange>
			            </requirement>
			            <requirement>
			               <type>p2-installable-unit</type>
			               <id>openjfx.graphics.win32_64</id>
			               <versionRange>0.0.0</versionRange>
			            </requirement>
			            <requirement>
			               <type>p2-installable-unit</type>
			               <id>openjfx.media.win32_64</id>
			               <versionRange>0.0.0</versionRange>
			            </requirement>
			            <requirement>
			               <type>p2-installable-unit</type>
			               <id>org.controlsfx</id>
			               <versionRange>0.0.0</versionRange>
			            </requirement>
			             <!--<requirement>
			               <type>p2-installable-unit</type>
			               <id>org.testfx.openjfx-monocle</id>
			               <versionRange>0.0.0</versionRange>
			            </requirement> -->
			         </extraRequirements>
			      </dependency-resolution>
			   </configuration>
			</plugin>
			
		</plugins>
	</build>




I hope this is totally wrong and somebody have a small hint for me to point the right way. (and a easy solution :-))


Thx 4 Help!




Re: Java 11 + Tycho-Surefire + bundled OpenJFX11 [message #1829351 is a reply to message #1828277] Wed, 01 July 2020 19:02 Go to previous messageGo to next message
Quang Tran is currently offline Quang TranFriend
Messages: 3
Registered: July 2020
Junior Member
I have the same problem. It's working in the IDE but not in the tycho build.
I run the tests with:
-Defxclipse.osgi.hook.debug=true -Dosgi.framework.extensions=org.eclipse.fx.osgi -Defxclipse.java-modules.dir=${javafx.home}\lib

but I always get the error
!ENTRY org.eclipse.osgi 4 0 2020-07-01 20:50:35.045
!MESSAGE Bundle org.eclipse.fx.osgi not found.
even though it is there.
My pom.xml
<plugin>
	<groupId>org.eclipse.tycho</groupId>
	<artifactId>target-platform-configuration</artifactId>
	<version>${tycho-version}</version>
	<configuration>
	<resolver>p2</resolver>
	<pomDependencies>consider</pomDependencies>
	<dependency-resolution>
		<extraRequirements>
			<requirement>
				<type>eclipse-plugin</type>
				<id>org.eclipse.fx.osgi</id>
				<versionRange>0.0.0</versionRange>
			</requirement>
		</extraRequirements>
	</dependency-resolution>
	<environments>
		<environment>
			<os>win32</os>
			<ws>win32</ws>
			<arch>x86_64</arch>
		</environment>
	</environments>
	</configuration>
</plugin>

<plugin>
	<groupId>org.eclipse.tycho</groupId>
	<artifactId>tycho-surefire-plugin</artifactId>
	<version>${tycho-version}</version>
	<configuration>
	<frameworkExtension>
		<frameworkExtension>
			<groupId>org.eclipse.fx.runtime</groupId>
			<artifactId>org.eclipse.fx.osgi</artifactId>
			<version>3.7.0</version>
		</frameworkExtension>
	</frameworkExtension>
	<argLine>${additionalTestArgLine} -Defxclipse.osgi.hook.debug=true -Dosgi.framework.extensions=org.eclipse.fx.osgi -Defxclipse.java-modules.dir=${javafx.home}\lib</argLine>
	</configuration>
</plugin>
Re: Java 11 + Tycho-Surefire + bundled OpenJFX11 [message #1829455 is a reply to message #1828277] Fri, 03 July 2020 22:16 Go to previous messageGo to next message
Quang Tran is currently offline Quang TranFriend
Messages: 3
Registered: July 2020
Junior Member
I think I've found out why this is not working. The tycho surefire frameworkExtension definition is not working as I would expected.
The eclipse documentation at https://wiki.eclipse.org/Adaptor_Hooks says:
Quote:
When using the osgi.framework.extensions property to specify a framework extension bundle the bundle symbolic name of the extension bundle must be used. In order for the extension bundle to be found and added to the framework implementation classpath it must be co-located in the same directory as the org.eclipse.osgi bundle at runtime and it must be a single jar (a directory does not work). In a normal eclipse runtime installation you would add your binary framework extension bundle jar to the directory eclipse/plugins/ of your eclipse installation. You also need to add the necessary osgi.framework.extensions property to the config.ini of you eclipse installation.


The OSGI runtime of tycho has not a standard layout as writen here : https://wiki.eclipse.org/Tycho/Testing_with_Surefire#Default_behaviour:_Create_OSGi_runtime_from_target_platform
The OSGI bundles tycho is using is:
C:/.m3/repository/p2/osgi/bundle/org.eclipse.fx.osgi/3.6.2.202001141050/org.eclipse.fx.osgi-3.6.2.202001141050.jar
C:/.m3/repository/p2/osgi/bundle/org.eclipse.osgi/3.13.100.v20180827-1536/org.eclipse.osgi-3.13.100.v20180827-1536.jar
which is not the standard layout for framework extensions

And also the necessary osgi.framework.extensions property was also not added in the config.ini in
${project.build.directory}/work/data/configuration


We could try to change the OSGi test runtime to p2Installed and check if it's working or fill a bug (I don't know if this behaviour is intended)

//Edit: I checked the tycho code, it should work...

[Updated on: Fri, 03 July 2020 22:39]

Report message to a moderator

Re: Java 11 + Tycho-Surefire + bundled OpenJFX11 [message #1829487 is a reply to message #1828277] Sat, 04 July 2020 22:06 Go to previous message
Quang Tran is currently offline Quang TranFriend
Messages: 3
Registered: July 2020
Junior Member
I managed to run org.eclipse.fx.osgi as a framework extension:

<frameworkExtensions>
	<frameworkExtension>
		<groupId>p2.osgi.bundle</groupId>
		<artifactId>org.eclipse.fx.osgi</artifactId>
		<version>3.6.2.202001141050</version>
	</frameworkExtension>
</frameworkExtensions>
Previous Topic:Problems and Crash with DriftFXSurface
Next Topic:openjdk 11, openjfx, eclipse rcp 2018-12
Goto Forum:
  


Current Time: Fri Sep 25 03:43:27 GMT 2020

Powered by FUDForum. Page generated in 0.02500 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top