Skip to content

Align default gson dependency version in generated provider SDKs with core SDK - #2284

Open
eon-pulumi-agent[bot] wants to merge 2 commits into
mainfrom
jkodroff/align-default-gson-version
Open

Align default gson dependency version in generated provider SDKs with core SDK#2284
eon-pulumi-agent[bot] wants to merge 2 commits into
mainfrom
jkodroff/align-default-gson-version

Conversation

@eon-pulumi-agent

Copy link
Copy Markdown

What

Bumps the hardcoded default com.google.code.gson:gson dependency version that the Java code generator injects into generated provider SDKs (build.gradle) from 2.8.9 to 2.10.1, and bumps the core SDK's own pin in sdk/java/pulumi/build.gradle from 2.10 to 2.10.1 so the two now match exactly.

Why (relates to #812)

#812 reports a Maven program hanging depending on whether a provider (e.g. azure-native) or com.pulumi:pulumi is listed first in pom.xml. The root cause identified in that thread was that generated provider SDKs pulled in different transitive versions of guava/gson than the core Pulumi Java SDK, and since these end up at the same depth in the dependency graph, Maven's dependency mediation breaks the tie using declaration order, so the resolved version (and thus runtime behavior) depended on pom.xml ordering.

The guava half of that problem was fixed shortly after the issue was filed (generated provider SDKs no longer declare a default guava dependency at all, so there's no more guava/grpc-netty classpath conflict — I verified this is no longer order-dependent with the current published com.pulumi:azure-native and com.pulumi:pulumi artifacts).

However, gson was never brought back in sync: pkg/codegen/java/package_info.go still defaulted generated provider SDKs to gson:2.8.9, while the core SDK's build.gradle has since moved to gson:2.10. I reproduced this with the real, currently-published Maven Central artifacts — the resolved gson version differed (2.8.9 vs 2.10) purely based on which dependency was listed first in a test pom.xml.

gson:2.10 isn't representable through the semver.Version type used here (Gson dropped the patch component for that release), so this change moves both pins to gson:2.10.1, a real, three-component, semver-parseable Gson release, so they line up exactly.

Testing

  • cd sdk/java && gradle build — core SDK unit tests pass with the new gson pin.
  • cd pkg/codegen/java && go test ./... (i.e. make codegen_tests) — full suite passes, including real gradle build/gradle test compiles of ~80 generated SDK fixtures against the new default.
  • PULUMI_ACCEPT=true regenerated the 35 golden build.gradle fixtures affected; each diff is exactly the one-line version bump.
  • golangci-lint run — clean.
  • Re-ran the Maven dependency-tree repro from the issue against the (locally rebuilt) SDK + a mini test provider with both dependency orderings to confirm gson now resolves identically either way.

Note on the original "hang"

The exact hang described in #812 was almost certainly caused by the guava mismatch, which is already fixed on main. This PR closes out the remaining, more minor gson skew so generated provider SDKs stay fully consistent with the core SDK going forward, and adds a comment to WithDefaultDependencies explaining why these versions must be kept in sync, referencing this issue.


Created with Eon

… core SDK

Generated provider SDKs (build.gradle) declared a hardcoded default
dependency on com.google.code.gson:gson:2.8.9, while the core Pulumi
Java SDK (com.pulumi:pulumi) has since moved on to gson:2.10. Because
these are declared at the same depth in a consumer's dependency graph,
Maven resolves the version based on pom.xml declaration order (first
declared wins on a tie), so a Maven user could get a different,
non-deterministic gson version depending on the order in which they
listed their provider and the pulumi dependency.

This is the same class of bug reported in #812 (guava/grpc-netty
version skew based on dependency order caused a program hang). The
guava mismatch was fixed shortly after that issue was filed by
dropping the default guava dependency from generated provider SDKs,
but the gson defaults were never kept in sync with the core SDK's
pinned version.

Bump both the core SDK's pinned gson version and the codegen default
to gson:2.10.1 (a real published, semver-parseable Gson release) so
they match exactly and Maven resolves the same version regardless of
pom.xml ordering.
@eon-pulumi-agent
eon-pulumi-agent Bot requested a review from jkodroff August 20, 2026 01:01
@eon-pulumi-agent
eon-pulumi-agent Bot requested a review from a team as a code owner August 20, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant