From 8025aa3bfa61e8b31342e6842ee7514da58b12fd Mon Sep 17 00:00:00 2001 From: Edward Poot Date: Wed, 13 Jul 2022 05:05:35 +0200 Subject: [PATCH] Fix: Always set jakarta_annotation_version (#12834) Commit 1735ab9d27656171def2440fa75cfe0c80a510f5 added changes to set the `jakarta_annotation_version`. I've recently noticed that when using retrofit2 library, the project builds fine with Maven but fails with Gradle. The build fails due to `Could not get unknown property 'jakarta_annotation_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler`. Digging into this, in the generated `build.gradle` the `jakarta_annotation_version` is never set. Upon closer inspection, aforementioned commit seems to indeed set it differently for the Maven build configuration than the Gradle build configuration (same for SBT configuration) for that matter. The issue is that due to human error the `jakarta_annotation_version` line is added within the `{{#usePlayWS}}` block, meaning it won't be generated when `usePlayWS` is false, even though it should. This commit changes this to always generate it. --- .../resources/Java/libraries/retrofit2/build.gradle.mustache | 2 +- samples/client/petstore/java/retrofit2-play26/build.gradle | 2 +- samples/client/petstore/java/retrofit2/build.gradle | 1 + samples/client/petstore/java/retrofit2rx2/build.gradle | 1 + samples/client/petstore/java/retrofit2rx3/build.gradle | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache index a9eb683f60..7f2b0569ae 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache @@ -105,9 +105,9 @@ ext { {{#openApiNullable}} jackson_databind_nullable_version = "0.2.3" {{/openApiNullable}} - jakarta_annotation_version = "1.3.5" play_version = "2.6.7" {{/usePlayWS}} + jakarta_annotation_version = "1.3.5" swagger_annotations_version = "1.5.22" junit_version = "4.13.2" {{#useRxJava2}} diff --git a/samples/client/petstore/java/retrofit2-play26/build.gradle b/samples/client/petstore/java/retrofit2-play26/build.gradle index 819ffd7803..49b13cac61 100644 --- a/samples/client/petstore/java/retrofit2-play26/build.gradle +++ b/samples/client/petstore/java/retrofit2-play26/build.gradle @@ -102,8 +102,8 @@ ext { jackson_version = "2.12.1" jackson_databind_version = "2.12.6.1" jackson_databind_nullable_version = "0.2.3" - jakarta_annotation_version = "1.3.5" play_version = "2.6.7" + jakarta_annotation_version = "1.3.5" swagger_annotations_version = "1.5.22" junit_version = "4.13.2" json_fire_version = "1.8.0" diff --git a/samples/client/petstore/java/retrofit2/build.gradle b/samples/client/petstore/java/retrofit2/build.gradle index 9fcc46882f..157c62f7de 100644 --- a/samples/client/petstore/java/retrofit2/build.gradle +++ b/samples/client/petstore/java/retrofit2/build.gradle @@ -99,6 +99,7 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" retrofit_version = "2.3.0" + jakarta_annotation_version = "1.3.5" swagger_annotations_version = "1.5.22" junit_version = "4.13.2" json_fire_version = "1.8.0" diff --git a/samples/client/petstore/java/retrofit2rx2/build.gradle b/samples/client/petstore/java/retrofit2rx2/build.gradle index da85e26ceb..82b659c48b 100644 --- a/samples/client/petstore/java/retrofit2rx2/build.gradle +++ b/samples/client/petstore/java/retrofit2rx2/build.gradle @@ -99,6 +99,7 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" retrofit_version = "2.3.0" + jakarta_annotation_version = "1.3.5" swagger_annotations_version = "1.5.22" junit_version = "4.13.2" rx_java_version = "2.1.1" diff --git a/samples/client/petstore/java/retrofit2rx3/build.gradle b/samples/client/petstore/java/retrofit2rx3/build.gradle index 2993b07fca..58563df94e 100644 --- a/samples/client/petstore/java/retrofit2rx3/build.gradle +++ b/samples/client/petstore/java/retrofit2rx3/build.gradle @@ -99,6 +99,7 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" retrofit_version = "2.3.0" + jakarta_annotation_version = "1.3.5" swagger_annotations_version = "1.5.22" junit_version = "4.13.2" rx_java_version = "3.0.4"