-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Open
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- 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
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_8It 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.