Message-ID: From: "vlsi (@vlsi)" To: "pgjdbc/pgjdbc" Date: Thu, 04 Jun 2026 19:48:48 +0000 Subject: [pgjdbc/pgjdbc] PR #4157: build: produce a multi-release jar from reduced-pom.xml on Java 11+ List-Id: X-GitHub-Additions: 36 X-GitHub-Author-Id: 213894 X-GitHub-Author-Login: vlsi X-GitHub-Base: master X-GitHub-Changed-Files: 1 X-GitHub-Commits: 1 X-GitHub-Deletions: 11 X-GitHub-Head-Branch: claude/crazy-dubinsky-5e9733 X-GitHub-Head-SHA: 94a55d2a7af2ca35430c17d0dc316243b8770f0b X-GitHub-Issue: 4157 X-GitHub-Merge-SHA: ce1e05576bef60a834a3b3bbf5f912403dadb3b3 X-GitHub-Merged-By: vlsi X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: merged X-GitHub-Type: pull_request X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/4157 Content-Type: text/plain; charset=utf-8 ## Why The source-distribution Maven build (`reduced-pom.xml`) compiled only the Java 8, `PhantomReference`-based `LazyCleanerImpl`. A jar built from the source tarball therefore never used the `java.lang.ref.Cleaner`-based implementation, even on Java 11+. The Gradle build already ships that implementation under `META-INF/versions/11`, so the two builds produced different artifacts. ## What - Add a second `maven-compiler-plugin` execution to the `jdkge11` profile that compiles `src/main/java11` with `release` 11 and `multiReleaseOutput=true`, placing the classes in `META-INF/versions/11`. - Uses only stock `maven-compiler-plugin` parameters (`compileSourceRoots`, `multiReleaseOutput`) — no extra plugins. - No Gradle changes: the `java11` sources are already in the source tarball (with checker annotations stripped) and the bundled manifest already carries `Multi-Release: true`. On Java 8 the `jdkge11` profile stays inactive, so the build keeps producing a plain (non-multi-release) jar, unchanged. ## How to verify Built the source distribution, extracted it, and ran Maven on JDK 21 (Maven on JDK 25): - `mvn package -DskipShadeDependencies=true` → `META-INF/versions/11/.../LazyCleanerImpl.class` present. - `mvn package` (shade, the default, with `minimizeJar=true`) → the `versions/11` overlay survives. - Bytecode major versions: base `52` (Java 8), `versions/11` `55` (Java 11). - Manifest carries `Multi-Release: true`. - Runtime on JDK 17 from the shaded jar loads the `Cleaner`-based implementation. - `:postgresql:sourceDistributionTest` (`mvn verify`) succeeds 🤖 Generated with [Claude Code](https://claude.com/claude-code) diff --git a/pgjdbc/reduced-pom.xml b/pgjdbc/reduced-pom.xml index d2b06a8d6c..4d15172bd3 100644 --- a/pgjdbc/reduced-pom.xml +++ b/pgjdbc/reduced-pom.xml @@ -163,17 +163,42 @@ [11,) - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.target.release} - - - - + + + org.apache.maven.plugins + maven-compiler-plugin + + + + default-compile + + ${java.target.release} + + + + + compile-java11 + compile + + compile + + + 11 + + ${project.basedir}/src/main/java11 + + true + + + + +