Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » NoClassDefFound when JUnit tests are run with Tycho
NoClassDefFound when JUnit tests are run with Tycho [message #1745158] Wed, 05 October 2016 19:55 Go to next message
Robert Smith is currently offline Robert SmithFriend
Messages: 4
Registered: October 2015
Junior Member
I'm trying to create a fragment Eclipse package of non-UI tests making use of JavaFX. The package works fine when run as a JUnit test, as does the non-test package in the build, but when run as part of a Tycho Maven build, I get NoClassDefFound errors on all JavaFX classes for the test project. My manifest has imports for the packages, I'm using Java 8 and Tycho 0.25.0, and I have the project's .pom file set up with this:

			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-compiler-plugin</artifactId>
				<version>${tycho-version}</version>
				<configuration>
					<encoding>UTF-8</encoding>
					<extraClasspathElements>
						<extraClasspathElement>
							<groupId>com.oracle</groupId>
							<artifactId>javafx</artifactId>
							<version>8.0.0-SNAPSHOT</version>
							<systemPath>${java.home}/lib/jfxswt.jar</systemPath>
							<scope>system</scope>
						</extraClasspathElement>
					</extraClasspathElements>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-surefire-plugin</artifactId>
				<version>${tycho-version}</version>
				<configuration>
					<argLine>-Dorg.osgi.framework.bundle.parent=ext</argLine>
				</configuration>
			</plugin>


What else am I missing to get these tests working in the build?
Re: NoClassDefFound when JUnit tests are run with Tycho [message #1745371 is a reply to message #1745158] Sat, 08 October 2016 19:26 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Looking at my tests this looks fairly the same. Are you developing a mixed mode app - I ask because you add the swtfx.jar and you mention to use package-imports for javafx classes!
Re: NoClassDefFound when JUnit tests are run with Tycho [message #1745442 is a reply to message #1745371] Mon, 10 October 2016 18:25 Go to previous messageGo to next message
Robert Smith is currently offline Robert SmithFriend
Messages: 4
Registered: October 2015
Junior Member
I don't think that any part of the app is mixed mode, it's just an RCP app. However, adding the jfxswt.jar as an extraClassPath is the only way I've found to make the non-test packages compile in the Maven Tycho build.
Re: NoClassDefFound when JUnit tests are run with Tycho [message #1745446 is a reply to message #1745442] Mon, 10 October 2016 19:17 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
The question is, do you create an swt based RCP application with some javafx controls, or are you creating an RCP application with javafx?
Re: NoClassDefFound when JUnit tests are run with Tycho [message #1745481 is a reply to message #1745446] Tue, 11 October 2016 12:34 Go to previous messageGo to next message
Robert Smith is currently offline Robert SmithFriend
Messages: 4
Registered: October 2015
Junior Member
The former. I'm creating the swt app and adding a few JavaFX controls to it.
Re: NoClassDefFound when JUnit tests are run with Tycho [message #1746589 is a reply to message #1745158] Tue, 01 November 2016 13:58 Go to previous message
Matthew Piggott is currently offline Matthew PiggottFriend
Messages: 1
Registered: July 2009
Junior Member
I think this relates to a question I asked on the tycho mailing list where fragments are excluded from the target platform - https://dev.eclipse.org/mhonarc/lists/tycho-user/msg07465.html

I never found an answer to it, in my case I was able to create a stubbed component without JavaFX since its only being used for the browser component.
Previous Topic:E4 Tools with e(fx)clipse
Next Topic:*.ldef file => generated java code?
Goto Forum:
  


Current Time: Thu Apr 18 09:16:46 GMT 2024

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

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

Back to the top