Require Java 17 or newer (#9358)

This commit is contained in:
Basil Crow 2024-06-11 07:52:23 -07:00 committed by GitHub
parent d4e970faee
commit 75f6c56c77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 55 additions and 26 deletions

4
Jenkinsfile vendored
View File

@ -14,12 +14,12 @@ properties([
def axes = [
platforms: ['linux', 'windows'],
jdks: [11, 17, 21],
jdks: [17, 21],
]
stage('Record build') {
retry(conditions: [kubernetesAgent(handleNonKubernetes: true), nonresumable()], count: 2) {
node('maven-11') {
node('maven-17') {
infra.checkoutSCM()
/*

View File

@ -78,16 +78,6 @@ public class JavaVersionRecommendationAdminMonitor extends AdministrativeMonitor
static {
NavigableMap<Integer, LocalDate> supportedVersions = new TreeMap<>();
// Adjust Java 11 end of life date for weekly and LTS
if (Jenkins.VERSION.split("[.]").length > 2) {
// LTS will require Java 17 or newer beginning 30 Oct 2024
// https://groups.google.com/g/jenkinsci-dev/c/gsXAqOQQEPc/m/VT9IBYdmAQAJ
supportedVersions.put(11, LocalDate.of(2024, 9, 30)); // Temurin: 2024-10-31
} else {
// Weekly will require Java 17 or newer beginning 18 Jun 2024
// https://groups.google.com/g/jenkinsci-dev/c/gsXAqOQQEPc/m/4fn4Un1iAwAJ
supportedVersions.put(11, LocalDate.of(2024, 6, 18)); // Temurin: 2024-10-31
}
supportedVersions.put(17, LocalDate.of(2026, 3, 31)); // Temurin: 2027-10-31
supportedVersions.put(21, LocalDate.of(2027, 9, 30)); // Temurin: 2029-09-30
SUPPORTED_JAVA_VERSIONS = Collections.unmodifiableNavigableMap(supportedVersions);

View File

@ -28,7 +28,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci</groupId>
<artifactId>jenkins</artifactId>
<version>1.115</version>
<version>1.116</version>
<relativePath />
</parent>

View File

@ -136,6 +136,51 @@ THE SOFTWARE.
<build>
<finalName>jenkins</finalName>
<plugins>
<!-- TODO When Java 11 usage declines to a terminal level, this can be deleted. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>display-info</id>
<configuration>
<rules>
<requireJavaVersion>
<version>11</version>
</requireJavaVersion>
<enforceBytecodeVersion>
<maxJdkVersion>11</maxJdkVersion>
<excludes>
<exclude>org.jenkins-ci:commons-jelly</exclude>
<exclude>org.jenkins-ci.main:cli</exclude>
<exclude>org.jenkins-ci.main:jenkins-core</exclude>
<exclude>org.jenkins-ci.main:websocket-jetty10</exclude>
<exclude>org.jenkins-ci.main:websocket-spi</exclude>
<exclude>org.kohsuke.stapler:stapler</exclude>
<exclude>org.kohsuke.stapler:stapler-groovy</exclude>
<exclude>org.kohsuke.stapler:stapler-jelly</exclude>
</excludes>
</enforceBytecodeVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>11</release>
<testRelease>11</testRelease>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<!-- version specified in grandparent pom -->

View File

@ -76,7 +76,7 @@ public class Main {
* This list must remain synchronized with the one in {@code
* JavaVersionRecommendationAdminMonitor}.
*/
private static final NavigableSet<Integer> SUPPORTED_JAVA_VERSIONS = new TreeSet<>(List.of(11, 17, 21));
private static final NavigableSet<Integer> SUPPORTED_JAVA_VERSIONS = new TreeSet<>(List.of(17, 21));
/**
* Sets custom session cookie name.

View File

@ -11,34 +11,28 @@ class MainTest {
void unsupported() {
assertJavaCheckFails(8, false);
assertJavaCheckFails(8, true);
assertJavaCheckFails(11, false);
assertJavaCheckFails(11, true);
}
@Test
void supported() {
assertJavaCheckPasses(11, false);
assertJavaCheckPasses(11, true);
assertJavaCheckPasses(17, false);
assertJavaCheckPasses(17, true);
assertJavaCheckPasses(21, false);
assertJavaCheckPasses(21, true);
}
@Test
void future() {
assertJavaCheckFails(12, false);
assertJavaCheckFails(13, false);
assertJavaCheckFails(14, false);
assertJavaCheckFails(15, false);
assertJavaCheckFails(16, false);
assertJavaCheckFails(18, false);
assertJavaCheckFails(19, false);
assertJavaCheckFails(20, false);
assertJavaCheckPasses(12, true);
assertJavaCheckPasses(13, true);
assertJavaCheckPasses(14, true);
assertJavaCheckPasses(15, true);
assertJavaCheckPasses(16, true);
assertJavaCheckFails(22, false);
assertJavaCheckPasses(18, true);
assertJavaCheckPasses(19, true);
assertJavaCheckPasses(20, true);
assertJavaCheckPasses(22, true);
}
private static void assertJavaCheckFails(int releaseVersion, boolean enableFutureJava) {