This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch CAY-2935 in repository https://gitbox.apache.org/repos/asf/cayenne.git
commit fa631c814629e3a2d854fd7d464e23d3d1d96385 Author: Andrus Adamchik <[email protected]> AuthorDate: Thu May 7 13:31:40 2026 -0400 CAY-2935 Upgrade Cayenne 5.0 to Java 21 --- .claude/rules/cayenne-gradle-plugin/build-jdk.md | 21 +++++---------- .github/workflows/verify-deploy-on-push.yml | 8 +++--- .github/workflows/verify-on-pr.yml | 2 +- CLAUDE.md | 2 +- RELEASE-NOTES.txt | 1 + UPGRADE.txt | 2 ++ cayenne-gradle-plugin/build.gradle | 2 +- .../org/apache/cayenne/tools/GradlePluginIT.java | 15 +---------- pom.xml | 30 ++++------------------ 9 files changed, 22 insertions(+), 61 deletions(-) diff --git a/.claude/rules/cayenne-gradle-plugin/build-jdk.md b/.claude/rules/cayenne-gradle-plugin/build-jdk.md index 7485e34a7..6b9f0e34c 100644 --- a/.claude/rules/cayenne-gradle-plugin/build-jdk.md +++ b/.claude/rules/cayenne-gradle-plugin/build-jdk.md @@ -1,22 +1,13 @@ --- paths: - "cayenne-gradle-plugin/**" -description: cayenne-gradle-plugin must build on Java 11 +description: cayenne-gradle-plugin Gradle version compatibility --- -Any Maven build that includes `cayenne-gradle-plugin` (the module itself, or -any reactor invocation that doesn't exclude it) must be run on **Java 11**. +The `cayenne-gradle-plugin` integration tests run Gradle builds via `exec-maven-plugin`. +The Gradle version is selected in `GradlePluginIT.java` based on the running JDK: -The module's tests run a Gradle build via `exec-maven-plugin`, which spins up a -Gradle daemon that compiles `build.gradle` with its embedded Groovy. That Groovy -version cannot read class files newer than the daemon's supported JVM. On newer -JDKs the build fails before any test runs with: +- Java >= 22 → Gradle 8.8 +- Java 21 (minimum baseline) → Gradle 8.5 -> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' -> Unsupported class file major version NN - -To run a full reactor build on a newer JDK, exclude this module: - -``` -mvn clean verify -pl '!cayenne-gradle-plugin' -``` +Gradle 8.5+ supports Java 21 class files, so the full reactor build works on Java 21+. diff --git a/.github/workflows/verify-deploy-on-push.yml b/.github/workflows/verify-deploy-on-push.yml index f4e665226..640afc583 100644 --- a/.github/workflows/verify-deploy-on-push.yml +++ b/.github/workflows/verify-deploy-on-push.yml @@ -24,15 +24,15 @@ jobs: verify: runs-on: ubuntu-latest name: JDK ${{ matrix.jdk }}, DB ${{ matrix.db-profile }} - continue-on-error: ${{ matrix.jdk == '22' }} + continue-on-error: ${{ matrix.jdk == '26' }} if: github.repository == 'apache/cayenne' strategy: matrix: - jdk: [11, 17, 21] + jdk: [21, 25] db-profile: [hsql, h2, derby, mysql-tc, postgres-tc, sqlserver-tc] include: - - jdk: 22 + - jdk: 26 db-profile: postgres-tc fail-fast: false # finish all jobs anyway @@ -70,7 +70,7 @@ jobs: if: contains(env.POM_VERSION, '-SNAPSHOT') with: distribution: 'temurin' - java-version: 11 + java-version: 21 cache: 'maven' - name: Deploy snapshot diff --git a/.github/workflows/verify-on-pr.yml b/.github/workflows/verify-on-pr.yml index e01ac90d2..9120cdef4 100644 --- a/.github/workflows/verify-on-pr.yml +++ b/.github/workflows/verify-on-pr.yml @@ -28,7 +28,7 @@ jobs: strategy: matrix: - jdk: [11, 17] + jdk: [21] db-profile: [hsql, h2, derby, mysql-tc, postgres-tc, sqlserver-tc] fail-fast: true diff --git a/CLAUDE.md b/CLAUDE.md index a24e9fe10..37c2c6b63 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project Overview -Apache Cayenne is a Java ORM and persistence framework. This is a multi-module Maven project (22 modules) targeting Java 11+. +Apache Cayenne is a Java ORM and persistence framework. This is a multi-module Maven project (22 modules) targeting Java 21+. ## Build Commands diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 52c230862..d13e84d9e 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -35,6 +35,7 @@ CAY-2929 Modeler: Prefrences management UI CAY-2930 Modeler: remove "rename" button from DB Import toolbar CAY-2932 Remove "Generate Classes" menu CAY-2933 Modeler: DB Type Column Unreadable for Selected Rows +CAY-2935 Upgrade Cayenne 5.0 to Java 21 CAY-2937 Decommission "graph" Support CAY-2938 Modeler: prettier DB Import - part 1 diff --git a/UPGRADE.txt b/UPGRADE.txt index 94174d86b..980b0a24d 100644 --- a/UPGRADE.txt +++ b/UPGRADE.txt @@ -7,6 +7,8 @@ IMPORTANT: be sure to read all notes for the intermediate releases between your UPGRADING TO 5.0.M2 +* Per CAY-2935 Minimum required Java version for Apache Cayenne 5.0 is 21 + * Per CAY-2937 the visual graph feature (entity layout diagrams) has been removed from CayenneModeler. Existing `.graph.xml` files will be automatically deleted and their references removed from `cayenne-project.xml` when a project is opened in the Modeler and upgraded to the newest format. diff --git a/cayenne-gradle-plugin/build.gradle b/cayenne-gradle-plugin/build.gradle index 88cc49ccf..760ae9c50 100644 --- a/cayenne-gradle-plugin/build.gradle +++ b/cayenne-gradle-plugin/build.gradle @@ -31,7 +31,7 @@ plugins { } java { - sourceCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_21 } repositories { diff --git a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/GradlePluginIT.java b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/GradlePluginIT.java index 7b2552101..5f9815124 100644 --- a/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/GradlePluginIT.java +++ b/cayenne-gradle-plugin/src/test/java/org/apache/cayenne/tools/GradlePluginIT.java @@ -53,24 +53,11 @@ public class GradlePluginIT extends BaseTaskIT { String[] versions; - // Old gradle versions will fail on new JDK int javaMajorVersion = getJavaMajorVersion(System.getProperty("java.version")); if(javaMajorVersion >= 22) { versions = new String[]{"8.8"}; - } else if(javaMajorVersion >= 21) { - versions = new String[]{"8.5"}; - } else if(javaMajorVersion >= 19) { - versions = new String[]{"7.6"}; - } else if(javaMajorVersion >= 17) { - versions = new String[]{"7.3"}; - } else if(javaMajorVersion >= 16) { - versions = new String[]{"7.0"}; - } else if(javaMajorVersion >= 11) { - versions = new String[]{"4.8"}; - } else if (javaMajorVersion < 9) { - versions = new String[]{"4.3", "4.0", "3.5"}; } else { - versions = new String[]{"4.3.1", "4.3"}; + versions = new String[]{"8.5"}; } List<String> failedVersions = new ArrayList<>(); diff --git a/pom.xml b/pom.xml index 48d183518..e47ad622a 100644 --- a/pom.xml +++ b/pom.xml @@ -44,8 +44,7 @@ <xmlunit.version>2.9.1</xmlunit.version> <junit.version>5.14.4</junit.version> - <maven.compiler.target>11</maven.compiler.target> - <maven.compiler.source>11</maven.compiler.source> + <maven.compiler.release>21</maven.compiler.release> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> @@ -667,7 +666,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-plugin-plugin</artifactId> - <version>3.6.4</version> + <version>3.13.1</version> </plugin> <plugin> <artifactId>maven-resources-plugin</artifactId> @@ -751,8 +750,7 @@ <configuration> <!-- Suppress errors in the JavaDocs (it should be cleaned one day...) --> <doclint>none</doclint> - <additionalOptions>${javadoc.additionalOptions}</additionalOptions> - <source>11</source> + <source>21</source> </configuration> </plugin> <plugin> @@ -1196,7 +1194,7 @@ <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>mssql-jdbc</artifactId> - <version>10.2.1.jre11</version> + <version>12.10.0.jre11</version> <scope>test</scope> </dependency> </dependencies> @@ -1213,7 +1211,7 @@ <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>mssql-jdbc</artifactId> - <version>10.2.1.jre11</version> + <version>12.10.0.jre11</version> <scope>test</scope> </dependency> </dependencies> @@ -1303,24 +1301,6 @@ </dependency> </dependencies> </profile> - <profile> - <id>java11-javadoc-html5-no-modules</id> - <activation> - <jdk>[11,14)</jdk> - </activation> - <properties> - <javadoc.additionalOptions>-html5 --no-module-directories</javadoc.additionalOptions> - </properties> - </profile> - <profile> - <id>java14-javadoc-html5</id> - <activation> - <jdk>[14,)</jdk> - </activation> - <properties> - <javadoc.additionalOptions>-html5</javadoc.additionalOptions> - </properties> - </profile> </profiles> <reporting>
