NullPointerException in QuarkusPluginExtension.beforeTest with Configuration Cache Enabled #46682
Labels
area/gradle
Gradle
kind/bug
Something isn't working
triage/needs-feedback
We are waiting for feedback.
Describe the bug
When running tests with the Quarkus Gradle plugin and Gradle’s configuration cache enabled, a NullPointerException occurs because the project field in io.quarkus.gradle.extension.QuarkusPluginExtension is null. This happens during the beforeTest method, which attempts to build an application model via ApplicationDeploymentClasspathBuilder, calling project.getPath() on a null project reference. The issue persists even when marking Quarkus tasks (except :test) as notCompatibleWithConfigurationCache, suggesting a deeper initialization problem in the plugin’s test setup.
Expected behavior
Test should run when org.gradle.configuration-cache=true
Actual behavior
This breaks test execution (e.g., ./gradlew :shopper-profile-api-controller:test), preventing JUnit 5/Kotest tests from running. Disabling the configuration cache (org.gradle.configuration-cache=false) resolves the issue, but we’d like to use the cache for build performance (targeting <20-30s Configuration time). Updating the Quarkus plugin version or tweaking test properties (e.g., quarkus.test.native-image=false) didn’t help.
How to Reproduce?
Steps to Reproduce:
Output of
uname -a
orver
Darwin LM-SJN-40042039 23.6.0 Darwin Kernel Version 23.6.0: Thu Dec 19 20:47:16 PST 2024; root:xnu-10063.141.1.703.2~1/RELEASE_ARM64_T6031 arm64
Output of
java -version
JVM 21
Quarkus version or git rev
3.16.4
Build tool (ie. output of
mvnw --version
orgradlew --version
)gradle 8.11.1
Additional information
Caused by: java.lang.NullPointerException: Cannot invoke "org.gradle.api.Project.getPath()" because "project" is null
at io.quarkus.gradle.dependency.ApplicationDeploymentClasspathBuilder.(ApplicationDeploymentClasspathBuilder.java:151)
at io.quarkus.gradle.tooling.GradleApplicationModelBuilder.buildAll(GradleApplicationModelBuilder.java:102)
at io.quarkus.gradle.tooling.ToolingUtils.create(ToolingUtils.java:186)
at io.quarkus.gradle.tooling.ToolingUtils.create(ToolingUtils.java:182)
at io.quarkus.gradle.extension.QuarkusPluginExtension.getApplicationModel(QuarkusPluginExtension.java:198)
at io.quarkus.gradle.extension.QuarkusPluginExtension.beforeTest(QuarkusPluginExtension.java:75)
The text was updated successfully, but these errors were encountered: