sts4: STS 4.4.0 no longer runs JUnit5 Tests - STS 4.3.2 did not have a problem

When I took STS 4.4.0 last Friday and ran my JUnit5 tests, I received this error:

java.lang.NoClassDefFoundError: org/junit/platform/commons/PreconditionViolationException
    at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createUnfilteredTest(JUnit5TestLoader.java:75)
    at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createTest(JUnit5TestLoader.java:66)
    at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.loadTests(JUnit5TestLoader.java:53)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:525)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Caused by: java.lang.ClassNotFoundException: org.junit.platform.commons.PreconditionViolationException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 7 more

The tests were working fine with version 4.3.2. The only non-base install plug-in I have is “EclEmma Java Code Coverage 3.1.2”, so I tried removing that from my install in 4.4.0 and that did not resolve the issue. When I downgraded back to 4.3.2, I was able to successfully run my tests again.

My basic STS install details for 4.3.2 are attached. STSInstallDetails.txt

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 27 (13 by maintainers)

Most upvoted comments

@martinlippert - I took Spring Tools release 4.5.1 today and have verified that the problem is no longer occurring. I’m not sure what the procedure is to close out an issue off your board(s). If I need to do the closing, could you let me know what I should do? Thanks very much.

Is there anyway I can debug this?

I’m not sure. If I had a project that triggers the bug I’d try poking at it in different ways until I figured something out, but it isn’t exactly a well-defined process.

But since its working for you now in latest nightly build I don’t think its worth spending a lot of effort on this. Whatever the problem was you ran into seems to be fixed and that’s what really matters.

Here is a workaround, when your project doesn’t inherit from the spring-boot-parent and imports spring-boot-dependencies instead:

	<dependencyManagement>
		<dependencies>

			<dependency>
				<groupId>org.junit</groupId>
				<artifactId>junit-bom</artifactId>
				<version>5.5.2</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-dependencies</artifactId>
				<version>2.1.8.RELEASE</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

		</dependencies>
	</dependencyManagement>