Skip to content

Commit

Permalink
[JEP-236] [JENKINS-68570] Require Java 11 or newer (#6083)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Jun 24, 2022
1 parent 6b5c21d commit c60ea92
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 87 deletions.
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
7 changes: 2 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
20 changes: 2 additions & 18 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,8 @@ THE SOFTWARE.
<artifactId>maven-surefire-plugin</artifactId>
<!-- Version specified in grandparent POM -->
<configuration>
<argLine>@{jacocoSurefireArgs}</argLine>
<!-- Make sure to keep the directives in test/pom.xml and war/pom.xml in sync with these. -->
<argLine>@{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</argLine>
<forkCount>0.5C</forkCount>
<reuseForks>false</reuseForks>
</configuration>
Expand Down Expand Up @@ -821,23 +822,6 @@ THE SOFTWARE.
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
</properties>
</profile>
<profile>
<id>jdk-9-and-above</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Make sure to keep the directives in test/pom.xml and war/pom.xml in sync with these. -->
<argLine>@{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</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>enable-jacoco</id>
<build>
Expand Down
5 changes: 2 additions & 3 deletions core/src/main/java/hudson/model/UpdateCenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
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;
Expand Down Expand Up @@ -1422,8 +1421,8 @@ private void testConnection(URL url) throws IOException {
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) {
Expand Down
34 changes: 3 additions & 31 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci</groupId>
<artifactId>jenkins</artifactId>
<version>1.76</version>
<version>1.77</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -85,8 +85,6 @@ THE SOFTWARE.
<project.patchManagement.url>https://api.github.com</project.patchManagement.url>
<patch.tracker.serverId>jenkins-jira</patch.tracker.serverId>

<animal.sniffer.skip>${skipTests}</animal.sniffer.skip>

<changelog.url>https://www.jenkins.io/changelog</changelog.url>

<!-- Bundled Remoting version -->
Expand Down Expand Up @@ -380,10 +378,6 @@ THE SOFTWARE.
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
Expand All @@ -406,7 +400,7 @@ THE SOFTWARE.
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>9.3</version>
<version>10.3</version>
</dependency>
</dependencies>
<executions>
Expand Down Expand Up @@ -471,7 +465,7 @@ THE SOFTWARE.
<arguments>-P release,sign</arguments>
<!-- work around for a bug in javadoc plugin that causes the release to fail. see MRELEASE-271 -->
<preparationGoals>clean install</preparationGoals>
<goals>-DskipTests -Danimal.sniffer.skip=false -Dspotbugs.skip -Dmaven.checkstyle.skip -Dspotless.check.skip generate-resources javadoc:javadoc deploy</goals>
<goals>-DskipTests -Dspotbugs.skip -Dmaven.checkstyle.skip -Dspotless.check.skip generate-resources javadoc:javadoc deploy</goals>
<pushChanges>false</pushChanges>
<localCheckout>true</localCheckout>
<tagNameFormat>jenkins-@{project.version}</tagNameFormat>
Expand Down Expand Up @@ -647,27 +641,5 @@ THE SOFTWARE.
<failIfNoTests>false</failIfNoTests>
</properties>
</profile>
<profile>
<id>jdk-17-and-above</id>
<activation>
<jdk>[17,)</jdk>
</activation>
<properties>
<!--
Animal Sniffer does not work on Java 17, but we cannot remove it from our configuration
entirely until we drop support for Java 8. As a temporary solution, we skip it when
running on Java 17. When JENKINS-54842 is resolved, this can be deleted.
-->
<animal.sniffer.skip>true</animal.sniffer.skip>

<!--
Spotless requires custom arguments to be added to .mvn/jvm.config when running on Java 17,
but we cannot add those custom arguments until we drop support for Java 8. As a temporary
workaround, we skip Spotless when running on Java 17. When JENKINS-68015 is resolved, this
can be deleted.
-->
<spotless.check.skip>true</spotless.check.skip>
</properties>
</profile>
</profiles>
</project>
5 changes: 4 additions & 1 deletion src/spotbugs/spotbugs-excludes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,10 @@
</And>
<And>
<Bug pattern="SSD_DO_NOT_USE_INSTANCE_LOCK_ON_SHARED_STATIC_DATA"/>
<Class name="hudson.model.ViewJob"/>
<Or>
<Class name="hudson.model.ViewJob"/>
<Class name="hudson.TcpSlaveAgentListener$ConnectionHandler"/>
</Or>
</And>
<And>
<Bug pattern="STATIC_IV"/>
Expand Down
30 changes: 5 additions & 25 deletions test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ THE SOFTWARE.
<mavenDebug>false</mavenDebug>
<!-- Filled in by jacoco-maven-plugin -->
<jacocoSurefireArgs />
<!--
Filled in by maven-hpi-plugin from the MANIFEST.MF entry in jenkins.war, but we provide a default value for the benefit of IDEs.
Make sure to keep the directives in core/pom.xml and war/pom.xml in sync with these.
-->
<jenkins.addOpens>--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</jenkins.addOpens>
<!-- Filled in by maven-hpi-plugin with the path to org-netbeans-insane-hook.jar extracted from jenkins-test-harness -->
<jenkins.insaneHook />
</properties>
Expand Down Expand Up @@ -367,30 +372,5 @@ THE SOFTWARE.
</plugins>
</build>
</profile>
<profile>
<id>jdk-8-and-below</id>
<activation>
<jdk>(,1.8]</jdk>
</activation>
<properties>
<!--
Filled in by maven-hpi-plugin from the MANIFEST.MF entry in jenkins.war, but we provide a default value for the benefit of IDEs.
-->
<jenkins.addOpens />
</properties>
</profile>
<profile>
<id>jdk-9-and-above</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<properties>
<!--
Filled in by maven-hpi-plugin from the MANIFEST.MF entry in jenkins.war, but we provide a default value for the benefit of IDEs.
Make sure to keep the directives in core/pom.xml and war/pom.xml in sync with these.
-->
<jenkins.addOpens>--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</jenkins.addOpens>
</properties>
</profile>
</profiles>
</project>

0 comments on commit c60ea92

Please sign in to comment.