Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require JDK 17 at build time (fixes #536) #537

Merged
merged 6 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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:
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/master-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-Dworkspace.root.dir=${session.rootDirectory}
-DprojectRoot=${session.rootDirectory}
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)

Expand Down
206 changes: 24 additions & 182 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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-06-20T20:44:27Z</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.12</ant.version>
Expand Down Expand Up @@ -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>
gnodet marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>

Expand Down
Loading