experiments\java\edu>
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by net.rubygrapefruit.platform.internal.NativeLibraryLoader in an unnamed module (file:/D:/OS/win/Dev/langs/java/bldeng/gradle/8.x/8.13/lib/native-platform-0.22-milestone-28.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'edu'.
> Could not create task ':test'.
> Could not create task of type 'Test'.
> Could not create an instance of type org.gradle.api.internal.tasks.testing.DefaultTestTaskReports.
> Could not create an instance of type org.gradle.api.reporting.internal.DefaultReportContainer.
> Type T not present
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 9s
Not OP but I’m running into this on Arch Linux 6.13.8 with Gradle 8.13 when using OpenJDK 24. I’ve created a new project using gradle init --type java-application and selected the default options each time.
When I run ./gradlew test the error posted by OP occurs. In contrast, ./gradlew run works.
Switching to OpenJDK 17 (using sudo archlinux-java set java-17-openjdk) makes the issue go away. This is the output of ./gradlew help when using OpenJDK 24:
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by net.rubygrapefruit.platform.internal.NativeLibraryLoader in an unnamed module (file:/home/me/.gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/lib/native-platform-0.22-milestone-28.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled
Reusing configuration cache.
> Task :help
Welcome to Gradle 8.13.
To run a build, run gradlew <task> ...
To see a list of available tasks, run gradlew tasks
To see more detail about a task, run gradlew help --task <task>
To see a list of command-line options, run gradlew --help
For more detail on using Gradle, see https://docs.gradle.org/8.13/userguide/command_line_interface.html
For troubleshooting, visit https://help.gradle.org
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
Configuration cache entry reused.
Oh, sorry, I mean gradlew --version, but you already have the relevant information for your case.
Running 8.13 on Java 24 is not supported: Compatibility Matrix
Thanks for the quick replies! I was thrown off because running applications with ./gradlew run works fine using JDK 24 (also with dependencies to JavaFX and H2) but the tests just wouldn’t run.