Skip to content

fix(java): apply sonatype-central-upload plugin conditionally on JVM 11+#16656

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1782160597-java-signed-publish-java8
Open

fix(java): apply sonatype-central-upload plugin conditionally on JVM 11+#16656
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1782160597-java-signed-publish-java8

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Description

The generated signed-publish build.gradle applied the cl.franciscosolis.sonatype-central-upload plugin unconditionally. That plugin's published Gradle module metadata declares an org.gradle.jvm.version = 11 constraint, so on a Java 8 JVM Gradle fails dependency resolution of the plugin classpath — the project cannot even configure, so ./gradlew compileJava fails. Seed CI compiles generated SDKs with a Java 8 JVM, which is why exhaustive:signed_publish (and exhaustive:publish-to) were in allowedFailures.

The fix gates the plugin behind a JVM-version check so the generated project configures/compiles on older JVMs while preserving publish behavior on JVM 11+ (the generated ci.yml already runs compile/test/publish on Java 11). Since the plugin literally cannot run on Java 8, gating it changes no real publish scenario.

This removes exhaustive:signed_publish from allowedFailures. exhaustive:publish-to is left in allowedFailures per scope, though its regenerated output is also fixed by the same change.

Changes Made

  • GeneratedBuildGradle: when signing/publishing, emit a leading buildscript {} block that adds the upload plugin to the build classpath only on JVM 11+, then apply it and configure the sonatypeCentralUpload {} extension and sonatypeCentralUpload.dependsOn build inside if (JavaVersion.current().isJava11Compatible()) { ... } guards. The core signing {} block stays unconditional (built-in, Java 8 compatible).
  • AbstractGeneratorCli: stop adding cl.franciscosolis.sonatype-central-upload to the declarative plugins {} block (it now lives in the JVM-gated buildscript classpath).
  • Regenerated seed/java-sdk/exhaustive/signed_publish/build.gradle and .../publish-to/build.gradle.
  • Removed exhaustive:signed_publish from seed/java-sdk/seed.yml allowedFailures.
  • Added Java SDK changelog entry.

Generated shape (signed publish):

buildscript {
    repositories { gradlePluginPortal(); mavenCentral() }
    dependencies {
        if (JavaVersion.current().isJava11Compatible()) {
            classpath 'cl.franciscosolis:SonatypeCentralUpload:1.0.3'
        }
    }
}
plugins { id 'java-library'; id 'maven-publish'; id 'com.diffplug.spotless' version '6.11.0'; id 'signing' }
if (JavaVersion.current().isJava11Compatible()) { apply plugin: 'cl.franciscosolis.sonatype-central-upload' }
...
if (JavaVersion.current().isJava11Compatible()) { sonatypeCentralUpload { ... } }
signing { ... sign publishing.publications.maven }
if (JavaVersion.current().isJava11Compatible()) { sonatypeCentralUpload.dependsOn build }

Testing

  • Manual testing completed
    • Reproduced the failure: ./gradlew compileJava on the generated signed_publish project with Java 8 failed with Dependency requires at least JVM runtime version 11. This build uses a Java 8 JVM.
    • After the fix, ./gradlew compileJava spotlessCheck succeeds on Java 8 for both signed_publish and publish-to.
    • On Java 17 the sonatypeCentralUpload task is still registered (type SonatypeCentralUploadTask) and sonatypeCentralUpload.dependsOn build configures cleanly — publish path intact.
    • pnpm run check (biome) and generators/java spotlessCheck both pass.

Link to Devin session: https://app.devin.ai/sessions/efe7d1c705d0485a910f7b8e03bad737
Requested by: @iamnamananand996


Open in Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread seed/java-sdk/seed.yml
Comment on lines 391 to 393
# runtime. Seed CI compiles generated SDKs with a Java 8 JVM, so Gradle cannot
# resolve the plugin classpath and the project fails to configure.
- exhaustive:publish-to

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🟡 exhaustive:publish-to not removed from allowedFailures despite receiving the same JVM 11 guard fix

The PR applies identical JVM 11 guards to both the exhaustive:publish-to and exhaustive:signed_publish fixtures (confirmed by the git diff updating both seed/java-sdk/exhaustive/publish-to/build.gradle and seed/java-sdk/exhaustive/signed_publish/build.gradle with the same buildscript classpath guard, conditional apply plugin, and guarded sonatypeCentralUpload blocks). However, only exhaustive:signed_publish was removed from allowedFailures at seed/java-sdk/seed.yml:393. The exhaustive:publish-to fixture remains listed as an allowed failure with a comment (seed/java-sdk/seed.yml:389-392) that is now inaccurate — the sonatype plugin is no longer unconditionally applied. This means CI silently skips test validation for the publish-to configuration path, so regressions won't be caught.

(Refers to lines 389-393)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — the same JVM 11 guard does fix exhaustive:publish-to too. Leaving it in allowedFailures here is intentional: this PR was scoped to remove only the exhaustive:signed_publish entry. The seed test treats a now-passing allowed-failure as a non-fatal "succeeded unexpectedly" warning (not a CI failure), so publish-to is still being run and validated — it just isn't being asserted as required yet. Happy to remove exhaustive:publish-to and update the stale comment in a follow-up (or here, if preferred).

@github-actions

Copy link
Copy Markdown
Contributor

SDK Generation Benchmark Results

Comparing PR branch against median of 5 nightly run(s) on main (latest: 2026-06-22T05:47:30Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
java-sdk square 235s (n=5) 282s (n=5) 196s -39s (-16.6%)

main (generator): generator-only time via --skip-scripts (includes Docker image build, container startup, IR parsing, and code generation — this is the same Docker-based flow customers use via fern generate). main (E2E): full customer-observable time including build/test scripts (nightly baseline, informational). Delta is computed against generator-only baseline.
⚠️ = generation exited with a non-zero exit code (timing may not reflect a successful run).
Baseline from nightly runs on main (latest: 2026-06-22T05:47:30Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-06-22 20:46 UTC

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