[BUG] ValidateTask does not work under Gradle 7.0
See original GitHub issueBug 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:
- Created 2 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please submit a PR
PR submitted here : #9453