This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mina-sshd.git
The following commit(s) were added to refs/heads/master by this push: new 9dcb788a7 Require JDK 17 at build time (fixes #536) (#537) 9dcb788a7 is described below commit 9dcb788a7da262b4773f24e6d69174b5fcff4ea6 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Fri Jul 26 08:34:21 2024 +0200 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(-) 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 @@ </scm> <properties> - <projectRoot>${project.basedir}</projectRoot> + <minimalJavaBuildVersion>17</minimalJavaBuildVersion> + <surefireJdk>[${minimalJavaBuildVersion},)</surefireJdk> + <minimalMavenBuildVersion>3.9.8</minimalMavenBuildVersion> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.outputTimestamp>2024-07-23T13:00:38Z</project.build.outputTimestamp> - <!-- NOTE: actual workspace root dir value updated by gmavenplus-plugin on initialization phase --> - <!-- workspace.root.dir>${project.basedir}</workspace.root.dir --> - - <java.major.version>1</java.major.version> - <java.minor.version>8</java.minor.version> <java.sdk.version>8</java.sdk.version> - <sniffer.signatures.version>1.0</sniffer.signatures.version> - <javac.source>${java.major.version}.${java.minor.version}</javac.source> + <javac.source>${java.sdk.version}</javac.source> <project.build.java.source>${javac.source}</project.build.java.source> <maven.compiler.source>${javac.source}</maven.compiler.source> <ant.version>1.10.14</ant.version> @@ -137,10 +134,25 @@ <profiles> <profile> - <id>release</id> - <properties> - <required.java.version>[1.8,1.9)</required.java.version> - </properties> + <id>toolchains</id> + <activation> + <property> + <name>surefireJdk</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <jdkToolchain> + <version>${surefireJdk}</version> + </jdkToolchain> + </configuration> + </plugin> + </plugins> + </build> </profile> <profile> @@ -318,21 +330,6 @@ <execute /> </action> </pluginExecution> - <pluginExecution> - <pluginExecutionFilter> - <groupId>org.codehaus.gmavenplus</groupId> - <artifactId>gmavenplus-plugin</artifactId> - <versionRange>[1.0,)</versionRange> - <goals> - <goal>compile</goal> - <goal>execute</goal> - <goal>testCompile</goal> - </goals> - </pluginExecutionFilter> - <action> - <execute /> - </action> - </pluginExecution> <pluginExecution> <pluginExecutionFilter> <groupId>org.apache.rat</groupId> @@ -752,27 +749,6 @@ </excludes> </configuration> </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>animal-sniffer-maven-plugin</artifactId> - <version>1.23</version> - <configuration> - <signature> - <groupId>org.codehaus.mojo.signature</groupId> - <artifactId>java${java.major.version}${java.minor.version}</artifactId> - <version>${sniffer.signatures.version}</version> - </signature> - </configuration> - <!-- make sure the signatures artifact is downloaded --> - <dependencies> - <dependency> - <groupId>org.codehaus.mojo.signature</groupId> - <artifactId>java${java.major.version}${java.minor.version}</artifactId> - <version>${sniffer.signatures.version}</version> - <type>pom</type> - </dependency> - </dependencies> - </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-scm-plugin</artifactId> @@ -844,56 +820,6 @@ </dependency> </dependencies> </plugin> - <plugin> - <groupId>org.codehaus.gmavenplus</groupId> - <artifactId>gmavenplus-plugin</artifactId> - <version>3.0.2</version> - <dependencies> - <!-- referenced indirectly by groovy-ant --> - <dependency> - <groupId>org.apache.ant</groupId> - <artifactId>ant</artifactId> - <version>${ant.version}</version> - </dependency> - <dependency> - <groupId>org.apache.ant</groupId> - <artifactId>ant-launcher</artifactId> - <version>${ant.version}</version> - </dependency> - <dependency> <!-- replace ant-junit artifact --> - <groupId>org.apache.ant</groupId> - <artifactId>ant-junit4</artifactId> - <version>${ant.version}</version> - </dependency> - <dependency> - <groupId>org.apache.ant</groupId> - <artifactId>ant-antlr</artifactId> - <version>${ant.version}</version> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>${junit.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.groovy</groupId> - <artifactId>groovy</artifactId> - <version>${groovy.version}</version> - </dependency> - <dependency> - <groupId>org.apache.groovy</groupId> - <artifactId>groovy-ant</artifactId> - <version>${groovy.version}</version> - <exclusions> - <exclusion> <!-- replaced by ant-junit4 --> - <groupId>org.apache.ant</groupId> - <artifactId>ant-junit</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> @@ -1091,52 +1017,10 @@ <staticGroups>java.,javax.,org.w3c.,org.xml.,junit.</staticGroups> </configuration> </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <version>${build-helper-maven-plugin.version}</version> - </plugin> </plugins> </pluginManagement> <plugins> - <plugin> - <groupId>org.codehaus.gmavenplus</groupId> - <artifactId>gmavenplus-plugin</artifactId> - <executions> - <!-- Works only for Maven 3.x --> - <execution> - <id>detect-workspace-root-dir</id> - <!-- NOTE: phase must be BEFORE checkstyle plugin one --> - <phase>validate</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <scripts> - <script> - <![CDATA[ - for (java.io.File file = new java.io.File(new java.net.URI('${project.baseUri}')); file != null; file = file.getParentFile()) { - if (!file.isDirectory()) { - continue - } - - java.io.File testFile = new java.io.File(file, 'LICENSE.txt') - if (testFile.canRead()) { - project.properties['workspace.root.dir'] = file.getAbsolutePath() - // System.out.println("Workspace root dir: " + project.properties['workspace.root.dir']) - return - } - } - - System.err.println("Failed to detect workspace root dir") - ]]> - </script> - </scripts> - </configuration> - </execution> - </executions> - </plugin> <plugin> <groupId>net.revelc.code.formatter</groupId> <artifactId>formatter-maven-plugin</artifactId> @@ -1206,19 +1090,6 @@ </execution> </executions> </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>animal-sniffer-maven-plugin</artifactId> - <executions> - <execution> - <id>check-java-api</id> - <phase>compile</phase> - <goals> - <goal>check</goal> - </goals> - </execution> - </executions> - </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> @@ -1430,18 +1301,6 @@ <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> </archive> </configuration> - <dependencies> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-archiver</artifactId> - <version>${maven.archiver.version}</version> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-archiver</artifactId> - <version>${plexus.archiver.version}</version> - </dependency> - </dependencies> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -1483,23 +1342,6 @@ </dependency> </dependencies> </plugin> - <!-- Automatically remove artifacts from local repository on clean --> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>remove-previous-artifact</id> - <phase>clean</phase> - <goals> - <goal>remove-project-artifact</goal> - </goals> - <configuration> - <removeAll>false</removeAll> - </configuration> - </execution> - </executions> - </plugin> </plugins> </build> 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 @@ <properties> <projectRoot>${project.basedir}/..</projectRoot> <apacheds.version>2.0.0.AM26</apacheds.version> + <surefire.argLine>--add-opens=java.base/sun.security.util=ALL-UNNAMED --add-opens=java.base/sun.security.x509=ALL-UNNAMED</surefire.argLine> </properties> <dependencyManagement> @@ -127,6 +128,9 @@ <artifactId>maven-surefire-plugin</artifactId> <configuration> <redirectTestOutputToFile>true</redirectTestOutputToFile> + <useModulePath>false</useModulePath> + <!-- See https://issues.apache.org/jira/browse/DIRSTUDIO-1277 --> + <argLine>${surefire.argLine}</argLine> </configuration> </plugin> <plugin> @@ -141,23 +145,15 @@ <profiles> <profile> - <id>test-on-java16+</id> + <id>surefireJdk8</id> <activation> - <jdk>[16,)</jdk> + <property> + <name>surefireJdk8</name> + </property> </activation> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <useModulePath>false</useModulePath> - <!-- See https://issues.apache.org/jira/browse/DIRSTUDIO-1277 --> - <argLine>--add-opens=java.base/sun.security.util=ALL-UNNAMED --add-opens=java.base/sun.security.x509=ALL-UNNAMED</argLine> - </configuration> - </plugin> - </plugins> - </build> + <properties> + <surefire.argLine /> + </properties> </profile> </profiles> </project>