Skip to content

[REQ][Java][okhttp-gson] Support the OkHttp 5 JVM artifact in Maven output #25852

Backlog

Description

@konard

Current behavior

OpenAPI Generator 7.28.0 generates a Java okhttp-gson Maven project with com.squareup.okhttp3:okhttp:4.12.0. On the current master branch, the okhttp-gson template still emits those coordinates. Maven consumers moving the generated project to OkHttp 5 also need the JVM artifact. Changing the version property alone leaves the multiplatform facade declared as the direct dependency.

Minimal reproduction

Save this as ping.yaml:

openapi: 3.0.3
info:
  title: OkHttp Maven probe
  version: 1.0.0
paths:
  /ping:
    get:
      operationId: ping
      responses:
        '200':
          description: OK
java -jar openapi-generator-cli-7.28.0.jar generate \
  -g java --library okhttp-gson -i ping.yaml -o generated \
  --additional-properties useJakartaEe=true
cd generated
mvn -Dokhttp-version=5.5.1 dependency:tree -Dincludes=com.squareup.okhttp3

The resolved dependency tree has this shape:

+- com.squareup.okhttp3:okhttp:jar:5.5.1:compile
\- com.squareup.okhttp3:logging-interceptor:jar:5.5.1:compile
   \- com.squareup.okhttp3:okhttp-jvm:jar:5.5.1:compile

Compilation succeeds in this example because the logging interceptor supplies the JVM artifact transitively. The OkHttp Maven setup documents okhttp-jvm as the direct artifact for JVM consumers.

Suggested change

Consider supporting a coordinated OkHttp 5 selection in the okhttp-gson Maven template, where the direct dependency is okhttp-jvm and the interceptor uses the same version. The new okhttp library from #25713 already emits okhttp-jvm; its Maven dependency logic could be shared or used as an implementation example. A generated Maven fixture with the Jakarta option can verify both the direct dependency and a compiled sample.

Router PR 811 works around the existing template with a Maven fixture declaring okhttp-jvm and logging-interceptor directly at 5.5.1. The generated client compiled and passed the HTTP round-trip probe with that pair.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions