From 9dcb788a7da262b4773f24e6d69174b5fcff4ea6 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Fri, 26 Jul 2024 08:34:21 +0200 Subject: [PATCH] Require JDK 17 at build time (fixes #536) (#537) --- .github/workflows/build.yml | 20 ++- .github/workflows/master-build.yml | 2 +- .mvn/maven.config | 2 + CHANGES.md | 5 + README.md | 3 +- pom.xml | 206 ++++------------------------- sshd-ldap/pom.xml | 26 ++-- 7 files changed, 61 insertions(+), 203 deletions(-) create mode 100644 .mvn/maven.config diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0eb87ee6b..a4c42304f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,8 +28,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-latest, windows-latest ] - java: [ '8' ] + os: [ ubuntu-latest ] + java: [ '17' ] steps: - uses: actions/checkout@v4 @@ -46,6 +46,11 @@ jobs: restore-keys: | ${{ matrix.os }}-maven- + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: '3.9.8' + - name: Build with maven run: mvn -B --errors --activate-profiles ci --no-transfer-progress package -DskipTests @@ -63,7 +68,9 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: ${{ matrix.java }} + java-version: | + ${{ matrix.java }} + 17 - uses: actions/cache@v4 with: @@ -72,9 +79,14 @@ jobs: restore-keys: | ${{ matrix.os }}-maven- + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: '3.9.8' + - name: Build and test with maven # Skip all static checks, they were already done in the compile jobs - run: mvn -B --errors --activate-profiles ci --no-transfer-progress package + run: mvn -B --errors --activate-profiles ci -DsurefireJdk${{ matrix.java }} -DsurefireJdk=${{ matrix.java }} --no-transfer-progress package - name: Archive test results and logs # if: success() || failure() to also get the test results on successful runs. diff --git a/.github/workflows/master-build.yml b/.github/workflows/master-build.yml index 7aa899eb8..c4c8d995c 100644 --- a/.github/workflows/master-build.yml +++ b/.github/workflows/master-build.yml @@ -47,7 +47,7 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: '8' + java-version: '17' # Create a ~/.m2/settings.xml referencing these environment variable names server-id: 'apache.snapshots.https' server-username: NEXUS_USERNAME diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 000000000..6f7ab7285 --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1,2 @@ +-Dworkspace.root.dir=${session.rootDirectory} +-DprojectRoot=${session.rootDirectory} diff --git a/CHANGES.md b/CHANGES.md index bfdb282b9..09d2d4c15 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -58,3 +58,8 @@ like any other registrar. It can be disabled via the system property ## Major Code Re-factoring +### JDK requirements + +The project now requires JDK 17 at build time +[GH-536](https://github.com/apache/mina-sshd/issues/536), while the target runtime +still remains unchanged to support JDK 8. diff --git a/README.md b/README.md index 906193ca8..b41afda43 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,8 @@ Sensitive issues such as security vulnerabilities must be reported through [priv # Core requirements -* Java 8+ (as of version 1.3) +* Java 8+ at runtime (as of version 2.3) +* Java 17+ at build time (as of version 2.14) * [Slf4j](https://www.slf4j.org/) diff --git a/pom.xml b/pom.xml index 9d8abc090..6583e67a6 100644 --- a/pom.xml +++ b/pom.xml @@ -79,18 +79,15 @@ - ${project.basedir} + 17 + [${minimalJavaBuildVersion},) + 3.9.8 + UTF-8 2024-07-23T13:00:38Z - - - - 1 - 8 8 - 1.0 - ${java.major.version}.${java.minor.version} + ${java.sdk.version} ${javac.source} ${javac.source} 1.10.14 @@ -137,10 +134,25 @@ - release - - [1.8,1.9) - + toolchains + + + surefireJdk + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + ${surefireJdk} + + + + + @@ -318,21 +330,6 @@ - - - org.codehaus.gmavenplus - gmavenplus-plugin - [1.0,) - - compile - execute - testCompile - - - - - - org.apache.rat @@ -752,27 +749,6 @@ - - org.codehaus.mojo - animal-sniffer-maven-plugin - 1.23 - - - org.codehaus.mojo.signature - java${java.major.version}${java.minor.version} - ${sniffer.signatures.version} - - - - - - org.codehaus.mojo.signature - java${java.major.version}${java.minor.version} - ${sniffer.signatures.version} - pom - - - org.apache.maven.plugins maven-scm-plugin @@ -844,56 +820,6 @@ - - org.codehaus.gmavenplus - gmavenplus-plugin - 3.0.2 - - - - org.apache.ant - ant - ${ant.version} - - - org.apache.ant - ant-launcher - ${ant.version} - - - org.apache.ant - ant-junit4 - ${ant.version} - - - org.apache.ant - ant-antlr - ${ant.version} - - - junit - junit - ${junit.version} - - - - org.apache.groovy - groovy - ${groovy.version} - - - org.apache.groovy - groovy-ant - ${groovy.version} - - - org.apache.ant - ant-junit - - - - - org.apache.maven.plugins maven-checkstyle-plugin @@ -1091,52 +1017,10 @@ java.,javax.,org.w3c.,org.xml.,junit. - - org.codehaus.mojo - build-helper-maven-plugin - ${build-helper-maven-plugin.version} - - - org.codehaus.gmavenplus - gmavenplus-plugin - - - - detect-workspace-root-dir - - validate - - execute - - - - - - - - - net.revelc.code.formatter formatter-maven-plugin @@ -1206,19 +1090,6 @@ - - org.codehaus.mojo - animal-sniffer-maven-plugin - - - check-java-api - compile - - check - - - - org.apache.maven.plugins maven-enforcer-plugin @@ -1430,18 +1301,6 @@ ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - org.apache.maven - maven-archiver - ${maven.archiver.version} - - - org.codehaus.plexus - plexus-archiver - ${plexus.archiver.version} - - org.apache.maven.plugins @@ -1483,23 +1342,6 @@ - - - org.codehaus.mojo - build-helper-maven-plugin - - - remove-previous-artifact - clean - - remove-project-artifact - - - false - - - - diff --git a/sshd-ldap/pom.xml b/sshd-ldap/pom.xml index 86c042e33..73f14c3b5 100644 --- a/sshd-ldap/pom.xml +++ b/sshd-ldap/pom.xml @@ -33,6 +33,7 @@ ${project.basedir}/.. 2.0.0.AM26 + --add-opens=java.base/sun.security.util=ALL-UNNAMED --add-opens=java.base/sun.security.x509=ALL-UNNAMED @@ -127,6 +128,9 @@ maven-surefire-plugin true + false + + ${surefire.argLine} @@ -141,23 +145,15 @@ - test-on-java16+ + surefireJdk8 - [16,) + + surefireJdk8 + - - - - org.apache.maven.plugins - maven-surefire-plugin - - false - - --add-opens=java.base/sun.security.util=ALL-UNNAMED --add-opens=java.base/sun.security.x509=ALL-UNNAMED - - - - + + +