Skip to content

native-build-tools for Maven might not be working with JUnit 5.13 #738

Closed
@michael-simons

Description

@michael-simons

I tried upgrading Neo4j-JDBC to JUnit 5.13, and suddenly native image tests fail:

https://github.com/neo4j/neo4j-jdbc/actions/runs/15384655216/job/43281320390#step:6:416

I See in the release notes that there are known changes:

The JUnit feature in GraalVM Native Build Tools has been rewritten to no longer require JUnit classes to be initialized at build time. Therefore, JUnit’s JARs no longer ship with native-image.properties files that contain --initialize-at-build-time options (introduced in 5.12.0). Please update to the most recent version of GraalVM Native Build Tools prior to upgrading to this version of JUnit

We are already on 0.10.6

https://github.com/neo4j/neo4j-jdbc/blob/main/pom.xml#L184

https://github.com/neo4j/neo4j-jdbc/blob/b10c35bee6be2852063a4aa8d11b7b43057f85d8/neo4j-jdbc-it/neo4j-jdbc-it-cp/pom.xml#L119-L151

After a bit of loud thinking here I took this repository and build todays version locally as 0.11.0-SNAPSHOT and tried my luck with the Neo4j JDBC driver, running the integration tests here as they used to work:

./mvnw -U -DskipClusterIT -Dnative clean verify  -pl neo4j-jdbc-it/neo4j-jdbc-it-cp -am

Using GraalVM 21 it is not quite helpful:

Error: Feature defined by org.graalvm.junit.platform.JUnitPlatformFeature unexpectedly failed with a(n) java.lang.RuntimeException. Please report this problem to the authors of org.graalvm.junit.platform.JUnitPlatformFeature.

Enabling Maven Stacktrace / debug just gives me a pretty useless stacktrace.

GraalVM 24 is more helpful

Error: Feature defined by org.graalvm.junit.platform.JUnitPlatformFeature unexpectedly failed with a(n) java.lang.RuntimeException. Please report this problem to the authors of org.graalvm.junit.platform.JUnitPlatformFeature.
Caused by: java.lang.RuntimeException: Cannot compute test selectors from test ids.
	at org.graalvm.junit.platform.JUnitPlatformFeature.getSelectors(JUnitPlatformFeature.java:147)
	at org.graalvm.junit.platform.JUnitPlatformFeature.beforeAnalysis(JUnitPlatformFeature.java:112)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$0(NativeImageGenerator.java:808)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:93)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:808)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:567)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:533)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:545)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:732)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:151)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:99)

While @marcphilipp suggested me the full list of classes that used to have to be initialized at build time, I'd rather not go down that route.

Hope you find this useful before a 0.11 release. Thank you!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions