question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] ValidateTask does not work under Gradle 7.0

See original GitHub issue

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What’s the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

ValidateTask stops working if gradle version is upgraded to 7.0.

The following task definition works under 6.8.3, but fails under 7.0:

val validateOpenApi by registering(ValidateTask::class) {
    group = "verification"
    description = "Validate openapi.yaml"
    recommend.set(true)
    input = "$rootDir/openapi.yaml"
}
val check by registering {
    dependsOn(validateOpenApi)
}

Here is the output:

* What went wrong:
Some problems were found with the configuration of task ':validateOpenApi' (type 'ValidateTask').
  - Type 'ValidateTask' property 'inputSpec' of mutable type 'org.gradle.api.provider.Property' is writable.

    Reason: Properties of type 'org.gradle.api.provider.Property' are already mutable.

    Possible solution: Remove the 'setInputSpec' method.

    Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#mutable_type_with_setter for more details about this problem.
  - Type 'ValidateTask' property 'recommend' of mutable type 'org.gradle.api.provider.Property' is writable.

    Reason: Properties of type 'org.gradle.api.provider.Property' are already mutable.

    Possible solution: Remove the 'setRecommend' method.

    Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#mutable_type_with_setter for more details about this problem.
openapi-generator version

id("org.openapi.generator") version "5.1.0" apply false

Suggest a fix

Apparently the following properties of ValidateTask should not be declared as var as they are already mutable properties anyway:

@get:InputFile
@PathSensitive(PathSensitivity.RELATIVE)
var inputSpec = project.objects.property<String>()

@Optional
@Input
var recommend = project.objects.property<Boolean?>()

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
wing328commented, May 10, 2021

Please submit a PR

2reactions
rm3lcommented, May 13, 2021

Please submit a PR

PR submitted here : #9453

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Gradle Plugin does not work with Gradle 7.0 · Issue #9253
WorkValidationException: A problem was found with the configuration of task ':microservice-with-api-api:openApiGenerate' (type 'GenerateTask').
Read more >
Dealing with validation problems - Gradle User Manual
This error occurs whenever a task or artifact transform is cacheable and that a file or file collection input property isn't declaring how...
Read more >
Known issues with Android Studio and Android Gradle Plugin
This section describes known issues that exist in the latest stable version of Android Studio. Error when rendering Compose Preview. Starting with Android ......
Read more >
OpenAPITools/openapi-generator v5.2.0 on GitHub
Once again, we would like to thank all contributors for their contributions. ... Fix Gradle Plugin ValidateTask not working under Gradle 7.0 #9453...
Read more >
Gradle doesn't sync in Android Studio - Stack Overflow
After this, gradle problem should fix, and try to disable gradle offline mode ... { classpath "com.android.tools.build:gradle:7.0.4" } }. in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found