js2d-gradle icon indicating copy to clipboard operation
js2d-gradle copied to clipboard

Fails with Gradle configuration cache enabled

Open sergeykad opened this issue 1 year ago • 10 comments

Running on Gradle 8.6 with enabled configuration cache results in the following failure:

* What went wrong:
Some problems were found with the configuration of task ':mymodule:generateJsonSchema2DataClassConfigMain' (type 'Js2pGenerationTask').
  - Type 'org.jsonschema2dataclass.js2p.Js2pGenerationTask' property 'js2dConfiguration' doesn't have a configured value.
    
    Reason: This property isn't marked as optional and no value has been configured.
    
    Possible solutions:
      1. Assign a value to 'js2dConfiguration'.
      2. Mark property 'js2dConfiguration' as optional.
    
    For more information, please refer to https://docs.gradle.org/8.6/userguide/validation_problems.html#value_not_set in the Gradle documentation.
  - Type 'org.jsonschema2dataclass.js2p.Js2pGenerationTask' property 'js2dConfigurationPlugins' doesn't have a configured value.
    
    Reason: This property isn't marked as optional and no value has been configured.
    
    Possible solutions:
      1. Assign a value to 'js2dConfigurationPlugins'.
      2. Mark property 'js2dConfigurationPlugins' as optional.
    
    For more information, please refer to https://docs.gradle.org/8.6/userguide/validation_problems.html#value_not_set in the Gradle documentation.

sergeykad avatar Feb 08 '24 14:02 sergeykad

Thank you for an issue.

There was an issue #788 for exactly that.

Patch wasn't successful though for Java >= 11. I'll be glad if you have a proper solution.

eirnym avatar Feb 08 '24 18:02 eirnym

With the latest Java LTS being 21 I am guessing most of the projects are on Java 11+ by now.
Unfortunately, I do not have experience in Kotlin or writing Gradle plugins, so I probably will not be able to help much. Maybe it's just adding the @Optional annotation as mentioned in the documentation?

sergeykad avatar Feb 11 '24 08:02 sergeykad

Kotlin is quite similar to Java even syntax is not the same. Don't worry about imperfect styling

Optional is not the case as information in the configuration is mandatory.

So it's important to find which variable has not been fulfilled for Gradle.

There's a disabled test which you can use and add an additional argument to pass a debug argument. In GradleVersions.kt there's listed all gradle versions to be tested, almost all of them can be disabled by commenting out or an environment variable to be passed.

Could you please help me?

eirnym avatar Feb 11 '24 09:02 eirnym

Links to files mentioned

https://github.com/jsonschema2dataclass/js2d-gradle/blob/main/plugin-gradle/plugin/src/test/kotlin/org/jsonschema2dataclass/js2p/JavaTaskFunctionalTest.kt

https://github.com/jsonschema2dataclass/js2d-gradle/blob/main/plugin-gradle/plugin/src/test/kotlin/org/jsonschema2dataclass/js2p/GradleVersions.kt

eirnym avatar Feb 11 '24 09:02 eirnym

Hi @sergeykad, I probably fixed the issue. Presumably, configurations must be visible to be cacheable. We'll see how tests will go.

eirnym avatar Feb 12 '24 19:02 eirnym

Hi @eirnym, sorry for nagging, but when do you think you will be able to release version 7? The last release was over a year ago.

sergeykad avatar Jun 05 '24 13:06 sergeykad

Thank you for nagging actually. Sorry for keeping you waining.

eirnym avatar Jun 05 '24 17:06 eirnym

Hi @eirnym , any news regarding when you will release a new version? This is the only issue that keeps us from using the configuration cache.

sergeykad avatar Aug 20 '24 06:08 sergeykad