From c60ea9210cb8db036c2cc1e446e789618b9744f3 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Fri, 24 Jun 2022 09:56:33 -0700 Subject: [PATCH] [JEP-236] [JENKINS-68570] Require Java 11 or newer (#6083) --- .github/dependabot.yml | 4 --- Jenkinsfile | 7 ++-- core/pom.xml | 20 ++--------- .../main/java/hudson/model/UpdateCenter.java | 5 ++- pom.xml | 34 ++----------------- src/spotbugs/spotbugs-excludes.xml | 5 ++- test/pom.xml | 30 +++------------- 7 files changed, 18 insertions(+), 87 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 095dd5abc4..69f351ca5c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -34,10 +34,6 @@ updates: # Fails test automation; needs further investigation. - dependency-name: "com.google.inject:guice-bom" - # Requires Java 11 starting with version 10.0. - - dependency-name: "com.puppycrawl.tools:checkstyle" - versions: [">=10.0"] - # Contains incompatible API changes and needs compatibility work. - dependency-name: "jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api" diff --git a/Jenkinsfile b/Jenkinsfile index 05f5fbf239..d764a739cc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,22 +13,19 @@ properties([ ]) def buildTypes = ['Linux', 'Windows'] -def jdks = [8, 11, 17] +def jdks = [11, 17] def builds = [:] for (i = 0; i < buildTypes.size(); i++) { for (j = 0; j < jdks.size(); j++) { def buildType = buildTypes[i] def jdk = jdks[j] - if (buildType == 'Windows' && jdk == 8) { - continue // unnecessary use of hardware - } if (buildType == 'Windows' && jdk == 17) { continue // TODO pending jenkins-infra/helpdesk#2822 } builds["${buildType}-jdk${jdk}"] = { // see https://github.com/jenkins-infra/documentation/blob/master/ci.adoc#node-labels for information on what node types are available - def agentContainerLabel = jdk == 8 ? 'maven' : 'maven-' + jdk + def agentContainerLabel = 'maven-' + jdk if (buildType == 'Windows') { agentContainerLabel += '-windows' } diff --git a/core/pom.xml b/core/pom.xml index 27554bf946..7ea13c2057 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -719,7 +719,8 @@ THE SOFTWARE. maven-surefire-plugin - @{jacocoSurefireArgs} + + @{jacocoSurefireArgs} --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.desktop/com.sun.beans.introspect=ALL-UNNAMED 0.5C false @@ -821,23 +822,6 @@ THE SOFTWARE. true - - jdk-9-and-above - - [9,) - - - - - maven-surefire-plugin - - - @{jacocoSurefireArgs} --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.desktop/com.sun.beans.introspect=ALL-UNNAMED - - - - - enable-jacoco diff --git a/core/src/main/java/hudson/model/UpdateCenter.java b/core/src/main/java/hudson/model/UpdateCenter.java index 1ac875c03c..3aad76f1f0 100644 --- a/core/src/main/java/hudson/model/UpdateCenter.java +++ b/core/src/main/java/hudson/model/UpdateCenter.java @@ -114,7 +114,6 @@ import jenkins.util.io.OnMaster; import net.sf.json.JSONObject; import org.apache.commons.io.IOUtils; import org.apache.commons.io.input.CountingInputStream; -import org.apache.commons.io.output.NullOutputStream; import org.jenkinsci.Symbol; import org.jvnet.localizer.Localizable; import org.kohsuke.accmod.Restricted; @@ -1422,8 +1421,8 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas throw new HttpRetryException("Invalid response code (" + responseCode + ") from URL: " + url, responseCode); } } else { - try (InputStream is = connection.getInputStream()) { - IOUtils.copy(is, NullOutputStream.NULL_OUTPUT_STREAM); + try (InputStream is = connection.getInputStream(); OutputStream os = OutputStream.nullOutputStream()) { + IOUtils.copy(is, os); } } } catch (SSLHandshakeException e) { diff --git a/pom.xml b/pom.xml index 9151a996c4..f0638bbcd3 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ THE SOFTWARE. org.jenkins-ci jenkins - 1.76 + 1.77 @@ -85,8 +85,6 @@ THE SOFTWARE. https://api.github.com jenkins-jira - ${skipTests} - https://www.jenkins.io/changelog @@ -380,10 +378,6 @@ THE SOFTWARE. - - org.codehaus.mojo - animal-sniffer-maven-plugin - com.github.spotbugs spotbugs-maven-plugin @@ -406,7 +400,7 @@ THE SOFTWARE. com.puppycrawl.tools checkstyle - 9.3 + 10.3 @@ -471,7 +465,7 @@ THE SOFTWARE. -P release,sign clean install - -DskipTests -Danimal.sniffer.skip=false -Dspotbugs.skip -Dmaven.checkstyle.skip -Dspotless.check.skip generate-resources javadoc:javadoc deploy + -DskipTests -Dspotbugs.skip -Dmaven.checkstyle.skip -Dspotless.check.skip generate-resources javadoc:javadoc deploy false true jenkins-@{project.version} @@ -647,27 +641,5 @@ THE SOFTWARE. false - - jdk-17-and-above - - [17,) - - - - true - - - true - - diff --git a/src/spotbugs/spotbugs-excludes.xml b/src/spotbugs/spotbugs-excludes.xml index 1e6be9807d..96dd3781fb 100644 --- a/src/spotbugs/spotbugs-excludes.xml +++ b/src/spotbugs/spotbugs-excludes.xml @@ -563,7 +563,10 @@ - + + + + diff --git a/test/pom.xml b/test/pom.xml index 84256a8e5f..8f0817ce98 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -42,6 +42,11 @@ THE SOFTWARE. false + + --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.desktop/com.sun.beans.introspect=ALL-UNNAMED @@ -367,30 +372,5 @@ THE SOFTWARE. - - jdk-8-and-below - - (,1.8] - - - - - - - - jdk-9-and-above - - [9,) - - - - --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.desktop/com.sun.beans.introspect=ALL-UNNAMED - -