[Java][microprofile] generate a Gradle build

Draft
IG
4mo ago
+5909-3

The microprofile library calls supportingFiles.clear() to drop the extra files added by the common Java client codegen, which also discards the Gradle build (build.gradle, settings.gradle, gradle.properties, gradlew, gradlew.bat and the wrapper). The samples therefore only ever contained a pom.xml, and the Gradle step of the Java client CI job had to be guarded to skip them, so the generated code was never compiled by Gradle.

This adds a build.gradle template for microprofile and re-registers the shared Gradle supporting files, following the same pattern as every other Java client library (each ships its own libraries/<lib>/build.gradle.mustache and inherits the rest from the common Java templates).

  • Java/libraries/microprofile/build.gradle.mustache mirrors the dependencies of the two pom templates: JSON-B / Jackson, MicroProfile Rest Client 2.0 (javax) and 3.0 (jakarta), mutiny, XML and bean validation. The Java release follows the poms (17 when useSealedOneOfInterfaces is set, otherwise 11 for MP 3.0 and 1.8 for MP 2.0).
  • The guard in samples-java-client-jdk17.yaml is removed, so microprofile-oneof-sealed is now built with Gradle like the other samples.

All 13 regenerated microprofile samples (12 clients + samples/server/petstore/java-microprofile, which shares the same code path) were verified locally with gradlew build -x test: the sealed sample on JDK 17 and the remaining ones on JDK 11. JavaClientCodegenTest passes (262 tests).

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    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*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Adds Gradle build generation for the Java microprofile library and enables Gradle builds for all MicroProfile samples in CI. This brings microprofile in line with other Java clients and ensures the code is compiled with Gradle.

  • New Features

    • Generate build.gradle for microprofile mirroring existing POMs: JSON‑B/Jackson, MicroProfile Rest Client 2.0 (javax) and 3.0 (jakarta), Mutiny, XML, and Bean Validation.
    • Set Java target: 17 when useSealedOneOfInterfaces is enabled; otherwise 11 for MP 3.0 and 1.8 for MP 2.0.
    • Register shared Gradle files in JavaClientCodegen (build.gradle, settings.gradle, gradle.properties, gradlew, wrapper).
  • Refactors

    • Remove the Gradle-skip guard in samples-java-client-jdk17.yaml; MicroProfile samples now build with Gradle like the rest.