Bug Report Checklist
Description
Using Gradle 9.x, the generated build.gradle file does not work. When running any task on this build.gradle file, the following error is reported:
FAILURE: Build failed with an exception.
* Where:
Build file '/tmp/openapi-generator/modules/openapi-generator-gradle-plugin/samples/local-spec/build/java-resttemplate-api-client/build.gradle' line: 81
* What went wrong:
A problem occurred evaluating root project 'client'.
> Could not set unknown property 'sourceCompatibility' for root project 'client' of type org.gradle.api.Project.
The build.gradle.mustache template does use deprecated and with Gradle 9 invalid syntax:
apply plugin: 'java'
apply plugin: 'maven-publish'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
It should be as follows, which is compatible with Gradle 7+:
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
Also some dependencies like Spring and Junit are not valid anymore.
openapi-generator version
Tested with latest main branch, i.e. v7.16.x
Steps to reproduce
Run gradlew buildJavaResttemplateSdk in sample OpenApi Generator project modules/openapi-generator-gradle-plugin/samples/local-spec
Suggest a fix
Update build.gradle.mustache as described above.
Bug Report Checklist
Description
Using Gradle 9.x, the generated build.gradle file does not work. When running any task on this build.gradle file, the following error is reported:
The build.gradle.mustache template does use deprecated and with Gradle 9 invalid syntax:
It should be as follows, which is compatible with Gradle 7+:
java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 }Also some dependencies like Spring and Junit are not valid anymore.
openapi-generator version
Tested with latest
mainbranch, i.e. v7.16.xSteps to reproduce
Run
gradlew buildJavaResttemplateSdkin sample OpenApi Generator projectmodules/openapi-generator-gradle-plugin/samples/local-specSuggest a fix
Update build.gradle.mustache as described above.