[jaxrs-spec] add useJackson3 option

ZO
1h ago
+13784-4

Fixes #25363

Adds a useJackson3 option to the jaxrs-spec generator. Jackson 2 stays the default.

  • useJackson3 option + cliOption, jacksonPackage property, JsonDeserialize import mapping (moved to tools.jackson.databind in Jackson 3)
  • spec/pom.mustache: {{jacksonPackage}} groupIds for the JAX-RS providers, jackson-datatype-jsr310 only for Jackson 2 (built into databind in Jackson 3), Jackson 3 version 3.1.2 (aligned with the CXF generator)
  • pojo.mustache: Shape.POJO instead of Shape.OBJECT for Jackson 3 when additional properties are used
  • Test testUseJackson3 in JavaJAXRSSpecServerCodegenTest
  • Docs regenerated. jaxrs-spec samples regenerated: no changes, since Jackson 2 output is identical.

openliberty/pom.mustache unchanged: it only depends on jackson-annotations, which keeps the com.fasterxml.jackson.core groupId in Jackson 3.

Notes / possible follow-ups:

  • USE_JACKSON_3 and the Jackson package constants are now duplicated across several generators. Happy to consolidate them into AbstractJavaCodegen in a follow-up PR.
  • 3.1.8 is the latest Jackson 3.1.x; I kept 3.1.2 for consistency with CXF, happy to bump.

Related: #25364 (resteasy client, separate PR).

cc @blaghed

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.
    @bbdouglas @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger @karismann @Zomzog @lwlee2608 @martin-mfg @KannaKim