Skip to content

Conversation

@ChristianMoesl
Copy link
Contributor

@ChristianMoesl ChristianMoesl commented Mar 10, 2023

This PR fixes build errors, because of wrong dependencies in the gradle build templates for java clients with spring dependencies (webclient & resttemplate) and useJakartaEe enabled.

This error can be reproduced quite easily on master branch with the following commands:

cd samples/client/petstore/java/webclient-jakarta
chmod +x gradlew && gradle clean build

It will result in build errors like these:
image

What was done:

  • remove swagger dependency, if it isn't in use
  • use jakarta >= 2.0 if useJakartaEe is enabled (only jakarta 2.0 and above exposes annotations in jakarta.annotations.* namespace)
  • use spring boot 3 and spring 6 for jakarta support
  • added a Gradle build step to CI

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • In case you are adding a new generator, run the following additional script :
    ./bin/utils/ensure-up-to-date.sh
    
    Commit all changed files.
  • File the PR against the correct branch: master (6.3.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@ChristianMoesl ChristianMoesl force-pushed the fix-gradle-build-with-jakarta branch from e7a4ce1 to 26e11f4 Compare March 13, 2023 07:07
@ChristianMoesl ChristianMoesl requested review from borsch and removed request for jimschubert March 13, 2023 07:09
@borsch
Copy link
Member

borsch commented Mar 13, 2023

Java @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10)
Java Spring @cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09)

Copy link
Contributor

@welshm welshm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@borsch
Copy link
Member

borsch commented Mar 13, 2023

@ChristianMoesl could you please check failed pipelines? For "Samples up-to-date" just pull latest master and ensure that you have regenerated samples for all project that are affected by your change

@ChristianMoesl ChristianMoesl force-pushed the fix-gradle-build-with-jakarta branch 2 times, most recently from 350b22d to 3066a07 Compare March 14, 2023 13:16
@ChristianMoesl ChristianMoesl force-pushed the fix-gradle-build-with-jakarta branch from 3066a07 to 3d03261 Compare March 14, 2023 13:23
@ChristianMoesl
Copy link
Contributor Author

@borsch I fixed the issues, which caused the pipeline to fail. There were 3 things to fix:

  • classifier property was removed in Gradle 8 and needed to be replaced by archiveClassifier
  • main property is deprecated in Gradle 8 and needed to be replaced by mainClass (to future proof it)
  • I had to generate all samples, not just the ones I used in my test case 😅

@borsch
Copy link
Member

borsch commented Mar 14, 2023

Not sure that exclusively supporting grade 8 is a good idea.. This simply means that we would force all clients of this generator to start using grade 8

FYI @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) @cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09)

@ChristianMoesl
Copy link
Contributor Author

ChristianMoesl commented Mar 14, 2023

Sry, I should have clarified the Gradle compatibility for this.
The mainClass property was introduced in Gradle 6.7
The archiveClassifier property was introduced in Gradle 5.1

So overall, the generated code will be compatible with Gradle >= 6.7, which sounds reasonable to me. Especially because the template generates a Gradle wrapper with version 7.2 anyway.

@borsch borsch merged commit 85ff3de into OpenAPITools:master Mar 14, 2023
@borsch borsch added this to the 6.5.0 milestone Mar 14, 2023
@ChristianMoesl ChristianMoesl deleted the fix-gradle-build-with-jakarta branch March 15, 2023 09:55
@ChristianMoesl ChristianMoesl restored the fix-gradle-build-with-jakarta branch March 15, 2023 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants