Skip to content

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

Open

Description

@Vest

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
}

Activity

  1. Vampire commented on Dec 23, 2025

    @Vampire

    I'd say MCVE is not really necessary here.
    Just apply the plugin to a play project and execute the runtime task and the jre task fails with the error :-(
    Would also greatly appreciate CC compatibility.

    Btw. if with "t is possible to use "warning"" you mean to use org.gradle.configuration-cache.problems=warn, then don't do that. This is just for on-going transitioning and fixing more problems in one go, not for persistent productive use. You easily break your builds that way or get very strange behavior that you then look at confused for hours.

  2. Vampire commented on Dec 23, 2025

    @Vampire

    There was PR #157 by @masterflitzer which stated to provide CC support.
    But the author closed that PR for some reason unmerged. :-(

  3. Vampire commented on Dec 23, 2025

    @Vampire

    But you can declare the tassks as CC-incompatible as work-around until this is fixed using notCompatibleWithConfigurationCache(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions