From 18e7b01e2b60598fae08048fbfde2f13ee43da5a Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Thu, 25 Jul 2024 11:05:51 +0200 Subject: [PATCH 1/6] Require JDK 17 at build time (fixes #536) --- .github/workflows/build.yml | 36 ++++- .github/workflows/master-build.yml | 2 +- .mvn/maven.config | 2 + README.md | 3 +- pom.xml | 252 +++++++++-------------------- 5 files changed, 109 insertions(+), 186 deletions(-) create mode 100644 .mvn/maven.config diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0eb87ee6b..cfd26727c 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,30 @@ 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,jdk8 "-DjdkToolchainVersion=[,9)" --no-transfer-progress package + if: matrix.java == '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 "-DjdkToolchainVersion=[11,12)" --no-transfer-progress package + if: matrix.java == '11' + + - 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 "-DjdkToolchainVersion=[17,18)" --no-transfer-progress package + if: matrix.java == '17' + - 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 "-DjdkToolchainVersion=[21,22)" --no-transfer-progress package + if: matrix.java == '21' - 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/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 fcbc28d7a..7e34e4233 100644 --- a/pom.xml +++ b/pom.xml @@ -79,18 +79,15 @@ - ${project.basedir} + 17 + [${minimalJavaBuildVersion},) + 3.9.8 + UTF-8 2024-06-20T20:44:27Z - - - - 1 - 8 8 - 1.0 - ${java.major.version}.${java.minor.version} + ${java.sdk.version} ${javac.source} ${javac.source} 1.10.12 @@ -137,10 +134,75 @@ - release + toolchains + + + jdkToolchainVersion + + + + + + org.apache.maven.plugins + maven-toolchains-plugin + 3.2.0 + + + load + validate + + select-jdk-toolchain + + + [${minimalJavaBuildVersion},) + Never + + + + pre-test + process-test-classes + + select-jdk-toolchain + + + ${jdkToolchainVersion} + Never + + + + + + + + + jdk8 - [1.8,1.9) + 8 + + + + net.revelc.code.formatter + formatter-maven-plugin + + + format + none + + + + + net.revelc.code + impsort-maven-plugin + + + sort-imports + none + + + + + @@ -318,21 +380,6 @@ - - - org.codehaus.gmavenplus - gmavenplus-plugin - [1.0,) - - compile - execute - testCompile - - - - - - org.apache.rat @@ -752,27 +799,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 +870,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 +1067,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 +1140,6 @@ - - org.codehaus.mojo - animal-sniffer-maven-plugin - - - check-java-api - compile - - check - - - - org.apache.maven.plugins maven-enforcer-plugin @@ -1430,18 +1351,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 +1392,6 @@ - - - org.codehaus.mojo - build-helper-maven-plugin - - - remove-previous-artifact - clean - - remove-project-artifact - - - false - - - - From 38c19dc435a875e3cd98f17422f1441559632d28 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Thu, 25 Jul 2024 12:48:11 +0200 Subject: [PATCH 2/6] Fix ldap --- pom.xml | 10 ++++++++++ sshd-ldap/pom.xml | 25 ++++++++----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/pom.xml b/pom.xml index 7e34e4233..c4a630240 100644 --- a/pom.xml +++ b/pom.xml @@ -174,6 +174,7 @@ + jdk8 @@ -204,6 +205,15 @@ + + jdk11 + + + jdk17 + + + jdk21 + ci diff --git a/sshd-ldap/pom.xml b/sshd-ldap/pom.xml index 38609217f..441a42ff9 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,10 @@ - test-on-java16+ - - [16,) - - - - - 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 - - - - + jdk8 + + + From f72aba9b162e083bcd1995d155da2adf5ba95174 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Thu, 25 Jul 2024 13:57:38 +0200 Subject: [PATCH 3/6] Simplify --- .github/workflows/build.yml | 18 +---------- pom.xml | 59 ++++--------------------------------- 2 files changed, 7 insertions(+), 70 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cfd26727c..a35feaf21 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -86,23 +86,7 @@ jobs: - 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,jdk8 "-DjdkToolchainVersion=[,9)" --no-transfer-progress package - if: matrix.java == '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 "-DjdkToolchainVersion=[11,12)" --no-transfer-progress package - if: matrix.java == '11' - - - 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 "-DjdkToolchainVersion=[17,18)" --no-transfer-progress package - if: matrix.java == '17' - - - 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 "-DjdkToolchainVersion=[21,22)" --no-transfer-progress package - if: matrix.java == '21' + run: mvn -B --errors --activate-profiles ci,jdk${{ matrix.java }} -DjdkToolchainVersion=${{ 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/pom.xml b/pom.xml index c4a630240..40956fba9 100644 --- a/pom.xml +++ b/pom.xml @@ -144,32 +144,12 @@ org.apache.maven.plugins - maven-toolchains-plugin - 3.2.0 - - - load - validate - - select-jdk-toolchain - - - [${minimalJavaBuildVersion},) - Never - - - - pre-test - process-test-classes - - select-jdk-toolchain - - - ${jdkToolchainVersion} - Never - - - + maven-surefire-plugin + + + ${jdkToolchainVersion} + + @@ -177,33 +157,6 @@ jdk8 - - 8 - - - - - net.revelc.code.formatter - formatter-maven-plugin - - - format - none - - - - - net.revelc.code - impsort-maven-plugin - - - sort-imports - none - - - - - jdk11 From 8c0234d08c52bfd910c6019fcd5d442a49e462d5 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Thu, 25 Jul 2024 15:28:08 +0200 Subject: [PATCH 4/6] Remove useless profiles --- .github/workflows/build.yml | 2 +- pom.xml | 19 +++---------------- sshd-ldap/pom.xml | 5 ++++- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a35feaf21..a4c42304f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -86,7 +86,7 @@ jobs: - 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,jdk${{ matrix.java }} -DjdkToolchainVersion=${{ matrix.java }} --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/pom.xml b/pom.xml index 40956fba9..ccbb7f5af 100644 --- a/pom.xml +++ b/pom.xml @@ -80,7 +80,7 @@ 17 - [${minimalJavaBuildVersion},) + [${minimalJavaBuildVersion},) 3.9.8 UTF-8 @@ -137,7 +137,7 @@ toolchains - jdkToolchainVersion + surefireJdk @@ -147,7 +147,7 @@ maven-surefire-plugin - ${jdkToolchainVersion} + ${surefireJdk} @@ -155,19 +155,6 @@ - - jdk8 - - - jdk11 - - - jdk17 - - - jdk21 - - ci diff --git a/sshd-ldap/pom.xml b/sshd-ldap/pom.xml index 441a42ff9..faa61964f 100644 --- a/sshd-ldap/pom.xml +++ b/sshd-ldap/pom.xml @@ -145,7 +145,10 @@ - jdk8 + surefireJdk8 + + surefireJdk8 + From c8a5e693199d1cc74af32b2ca414b2fb3eae4042 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Fri, 26 Jul 2024 00:04:50 +0200 Subject: [PATCH 5/6] Fix --- sshd-ldap/pom.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sshd-ldap/pom.xml b/sshd-ldap/pom.xml index faa61964f..692fea2a9 100644 --- a/sshd-ldap/pom.xml +++ b/sshd-ldap/pom.xml @@ -147,7 +147,9 @@ surefireJdk8 - surefireJdk8 + + surefireJdk8 + From f270ea65091af00cf8003d573a928621aff1ba39 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Fri, 26 Jul 2024 07:55:44 +0200 Subject: [PATCH 6/6] Add changelog --- CHANGES.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index f50b0ae50..23e38ec1c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -44,3 +44,8 @@ ## 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.