From fe04acad1f152d7fac0536823f8112d890a6b78f Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Mon, 10 Mar 2025 15:14:08 +0100 Subject: [PATCH 1/4] Bump build requirement to JDK 17 This change: - Bumps the build requirement for the project to JDK 17. - Adds a `java8-tests` profile that runs tests using JRE 8. The profile activates if a Maven Toolchains configuration file is present, i.e., the user knows about Maven Toolchains. Toolchains are automatically configured by `actions/setup-java`. - Bumps the version of Error Prone to a version compatible with JDK 17 (i.e., latest). - Bumps the version of Maven Surefire to a version that supports the `jdkToolchain` property. - Locks the version of the remaining plugins to the currently used versions. --- .mvn/jvm.config | 10 +++ README.md | 6 ++ pom.xml | 186 +++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 169 insertions(+), 33 deletions(-) create mode 100644 .mvn/jvm.config diff --git a/.mvn/jvm.config b/.mvn/jvm.config new file mode 100644 index 0000000..504456f --- /dev/null +++ b/.mvn/jvm.config @@ -0,0 +1,10 @@ +--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED +--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED +--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED diff --git a/README.md b/README.md index 80e0169..47e00a9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,13 @@ This project implements a purl parser and class for Java. +## Requirements + +- The library has a **runtime** requirement of JRE 8 or newer. +- To **build** the library from source, you need JDK 17 or newer. + ## Compiling + ```bash mvn clean install ```` diff --git a/pom.xml b/pom.xml index d1e6d30..e2e3aa4 100644 --- a/pom.xml +++ b/pom.xml @@ -37,21 +37,39 @@ - 1.8 - 1.8 + 8 UTF-8 UTF-8 false + + + 17 + + 18 + + 2.5 3.11.0 + 2.7 + 3.4.1 + 2.4 3.3.0 3.6.3 3.0.1 + 2.6 + 3.3 3.3.0 + 3.5.2 - 2.8.5 - 2.3.2 + 2.36.0 0.8.11 4.8.3.1 4.8.3 @@ -116,6 +134,31 @@ + + org.apache.maven.plugins + maven-clean-plugin + ${maven.clean.plugin.version} + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.plugin.version} + + + org.apache.maven.plugins + maven-deploy-plugin + ${maven.deploy.plugin.version} + + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven.enforcer.plugin.version} + + + org.apache.maven.plugins + maven-install-plugin + ${maven.install.plugin.version} + org.apache.maven.plugins maven-jar-plugin @@ -128,33 +171,77 @@ org.apache.maven.plugins - maven-compiler-plugin - ${maven.compiler.plugin.version} - - javac-with-errorprone - true - true - - -Xlint - - - - - org.codehaus.plexus - plexus-compiler-javac-errorprone - ${plexus.compiler.javac.errorprone.version} - - - - com.google.errorprone - error_prone_core - ${error.prone.core.version} - - + maven-resources-plugin + ${maven.resources.plugin.version} + + + org.apache.maven.plugins + maven-site-plugin + ${maven.site.plugin.version} + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-build-environment + + enforce + + + + + true + [${min.jdk.version},) + To build this library you need JDK ${min.jdk.version} or higher. + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${maven.compiler.release} + true + + -Xlint:all + + -XDcompilePolicy=simple + --should-stop=ifError=FLOW + -Xplugin:ErrorProne + + -proc:none + + + + + + com.google.errorprone + error_prone_core + ${error.prone.core.version} + + + + com.github.spotbugs spotbugs-maven-plugin @@ -250,6 +337,41 @@ + + + + java8-tests + + + ${user.home}/.m2/toolchains.xml + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + default-test + + + [1.8,9) + + + + + + + + + release @@ -260,17 +382,15 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.4.1 - enforce-java - - enforce - + enforce-build-environment - 1.8.0 + true + [${min.jdk.version},${max.jdk.version}) + To release this library you need JDK ${min.jdk.version}. From 5dd8b8fcdc11ec5e1a2fe179a94aef9eec20f061 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Tue, 11 Mar 2025 11:02:01 +0100 Subject: [PATCH 2/4] Update JDKs used by CI --- .github/workflows/maven.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index a4f8f2a..839ae75 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -2,21 +2,36 @@ name: Maven CI on: [push, pull_request] +permissions: read-all + jobs: build: strategy: matrix: os: [ ubuntu-latest ] - java-version: [ 8 ] + java-version: [ 17 ] distro: [ 'zulu', 'temurin' ] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4.1.1 - - name: Set up JDK ${{ matrix.java-version }} + + - name: Checkout repository + uses: actions/checkout@v4.1.1 + + - name: Set up JDK 8 and ${{ matrix.java-version }} uses: actions/setup-java@v4 with: distribution: ${{ matrix.distro }} - java-version: ${{ matrix.java-version }} + # We install two JDKs: + # * The first one is used by tests through Maven Toolchains. + # * The second one is used by Maven itself to perform the build. + # + # WARNING: The order matters. + # The last version specified will be assigned to JAVA_HOME. + java-version: | + 8 + ${{ matrix.java-version }} + - name: Build with Maven - run: mvn package --file pom.xml + shell: bash + run: mvn verify From 91d8d047e954bb7111d77007016ad4a5ef48e36c Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Tue, 11 Mar 2025 11:22:48 +0100 Subject: [PATCH 3/4] Add `.java-version` file --- .java-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .java-version diff --git a/.java-version b/.java-version new file mode 100644 index 0000000..8e2afd3 --- /dev/null +++ b/.java-version @@ -0,0 +1 @@ +17 \ No newline at end of file From da461439c37e610491c418117155a832af6bfc74 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Tue, 11 Mar 2025 15:26:58 +0100 Subject: [PATCH 4/4] Add EOL --- .java-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.java-version b/.java-version index 8e2afd3..98d9bcb 100644 --- a/.java-version +++ b/.java-version @@ -1 +1 @@ -17 \ No newline at end of file +17