jsonschema2dataclass / js2d-gradle

Extended Jsonschema2Pojo gradle plugin
Apache License 2.0
44 stars 10 forks source link

Fails with Gradle configuration cache enabled #884

Open sergeykad opened 8 months ago

sergeykad commented 8 months ago

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.
eirnym commented 8 months ago

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.

sergeykad commented 8 months ago

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?

eirnym commented 8 months ago

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 commented 8 months ago

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 commented 7 months ago

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

sergeykad commented 4 months ago

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.

eirnym commented 4 months ago

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

sergeykad commented 1 month ago

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.