Gradle v7.0 + OpenApi Generator Gradle plugin error about mutable type
Asked Answered
C

0

7

I'm currently in the process of updating a gradle project with OpenApiGenerator plugin. I updated both the gradle version (v7.0) and the OpenApiGenerator plugin version (5.1.0).

When I'm trying to build, I receive this strange message:

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

Here is the script:

apply plugin: 'org.openapi.generator'

description = """OpenApi API Validator"""

def openApiInput = file(tasks.getByName('processResources').outputs.files.singleFile.absolutePath + "\\openapi.yml")

openApiValidate {
    inputSpec = openApiInput.path
}

tasks.findByName('openApiValidate').inputs.files openApiInput
tasks.findByName('openApiValidate').outputs.dir project.buildDir
tasks.findByName('openApiValidate').dependsOn 'processResources'
classes.dependsOn 'openApiValidate'

tasks.findByName('openApiGenerate').enabled = false

Any idea how I can fix this problem? Thanks!

Chanteuse answered 20/4, 2021 at 17:12 Comment(2)
I just had the same problem. Seems to be an incompatibility how the plugin is written. The only solution was to downgrade Gradle to 6.x.Waldron
I had a similar issue, and downgrading to the version 6.X didn't solve the problem. I was also using a recent version of Spring Boot, with JDK17, so trying another older version of Gradle wasn't an option. The way around this is specifying the parameter inputSpec like this (I'm using openapi generator 5.3.0): ">gradle openApiGenerate --input=src/main/resources/swagger.yml"Kimmi

© 2022 - 2024 — McMap. All rights reserved.