badass-runtime-plugin icon indicating copy to clipboard operation
badass-runtime-plugin copied to clipboard

Cannot use Gradle's configuration caching because of org.beryx.runtime.JreTask

Open Vest opened this issue 2 months ago • 0 comments

Hello everyone,

I am currently evaluating new Gradle's feature: https://docs.gradle.org/9.2.1/userguide/configuration_cache.html And I have found out that the "jre" task cannot be cached, because it uses Project during the execution time.

I know, it is possible to use "warning" and ignore it, but maybe you can improve your plugin. Here is the warning message, how I see it from the report:

invocation of `Task.project` at execution time is unsupported with the configuration cache.

- task `:jre` of type `org.beryx.runtime.JreTask`
    - Exception at `org.beryx.runtime.BaseTask.getDefaultJavaHome(BaseTask.groovy:55)`

(link to detailed description: https://docs.gradle.org/9.2.1/userguide/configuration_cache_requirements.html#config_cache:requirements:use_project_during_execution).

Here is the actual exception:

Exception at `org.beryx.runtime.BaseTask.getDefaultJavaHome(BaseTask.groovy:55)`
    org.gradle.api.InvalidUserCodeException: Invocation of 'Task.project' by task ':jre' at execution time is unsupported with the configuration cache.
    	at org.gradle.api.DefaultTask.getProject(DefaultTask.java:60)
    	at org.beryx.runtime.BaseTask.getDefaultJavaHome(BaseTask.groovy:55)
    	at org.beryx.runtime.JreTask_Decorated.getDefaultJavaHome(Unknown Source)
    	at org.beryx.runtime.BaseTask.getJavaHomeOrDefault(BaseTask.groovy:46)
    	at org.beryx.runtime.JreTask_Decorated.getJavaHomeOrDefault(Unknown Source)
    	at org.beryx.runtime.JreTask.getJavaHome(JreTask.groovy:48)
    	at org.beryx.runtime.JreTask_Decorated.getJavaHome(Unknown Source)
    	at org.gradle.internal.properties.bean.DefaultPropertyWalker$CachedPropertyValue.lambda$new$0(DefaultPropertyWalker.java:117)
    	at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:198)
    	at java.base/java.lang.Thread.run(Thread.java:1474)

To break my project, I followed recommendation from Gradle, and used these settings & parameters:

// settings.gradle:
enableFeaturePreview "STABLE_CONFIGURATION_CACHE"

// gradle.properties:
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true

I don't have a working repo for you, because I am currently experimenting with one open-source (https://github.com/PCGen/pcgen) repo, and my task is quite simple:

tasks.named("jre") {
    dependsOn downloadJRE, downloadJavaFXModules
}

Vest avatar Nov 25 '25 13:11 Vest