diff --git a/ci/images/ci-image-jdk18/Dockerfile b/ci/images/ci-image-jdk18/Dockerfile
new file mode 100644
index 000000000000..093caf8c68cb
--- /dev/null
+++ b/ci/images/ci-image-jdk18/Dockerfile
@@ -0,0 +1,12 @@
+FROM ubuntu:focal-20220113
+
+ADD setup.sh /setup.sh
+ADD get-jdk-url.sh /get-jdk-url.sh
+ADD get-docker-url.sh /get-docker-url.sh
+RUN ./setup.sh java8 java18
+
+ENV JAVA_HOME /opt/openjdk
+ENV PATH $JAVA_HOME/bin:$PATH
+ADD docker-lib.sh /docker-lib.sh
+
+ENTRYPOINT [ "switch", "shell=/bin/bash", "--", "codep", "/bin/docker daemon" ]
diff --git a/ci/images/get-jdk-url.sh b/ci/images/get-jdk-url.sh
index 99a521ad3e7a..8cb154a42472 100755
--- a/ci/images/get-jdk-url.sh
+++ b/ci/images/get-jdk-url.sh
@@ -11,6 +11,9 @@ case "$1" in
java17)
echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.2%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.2_8.tar.gz"
;;
+ java18)
+ echo "https://github.com/adoptium/temurin18-binaries/releases/download/jdk18-2022-02-15-13-13-beta/OpenJDK18-jdk_x64_linux_hotspot_2022-02-15-13-13.tar.gz"
+ ;;
*)
echo $"Unknown java version"
exit 1
diff --git a/ci/pipeline.yml b/ci/pipeline.yml
index b246b4fa4de6..74421cd08fab 100644
--- a/ci/pipeline.yml
+++ b/ci/pipeline.yml
@@ -175,6 +175,12 @@ resources:
source:
<<: *registry-image-resource-source
repository: ((docker-hub-organization))/spring-boot-ci-jdk17
+- name: ci-image-jdk18
+ type: registry-image
+ icon: docker
+ source:
+ <<: *registry-image-resource-source
+ repository: ((docker-hub-organization))/spring-boot-ci-jdk18
- name: artifactory-repo
type: artifactory-resource
icon: package-variant
@@ -207,6 +213,14 @@ resources:
access_token: ((github-ci-status-token))
branch: ((branch))
context: jdk17-build
+- name: repo-status-jdk18-build
+ type: github-status-resource
+ icon: eye-check-outline
+ source:
+ repository: ((github-repo-name))
+ access_token: ((github-ci-status-token))
+ branch: ((branch))
+ context: jdk18-build
- name: slack-alert
type: slack-notification
icon: slack
@@ -259,6 +273,14 @@ jobs:
vars:
ci-image-name: ci-image-jdk17
<<: *docker-hub-mirror-vars
+ - task: build-ci-image-jdk18
+ privileged: true
+ file: git-repo/ci/tasks/build-ci-image.yml
+ output_mapping:
+ image: ci-image-jdk18
+ vars:
+ ci-image-name: ci-image-jdk18
+ <<: *docker-hub-mirror-vars
- in_parallel:
- put: ci-image
params:
@@ -269,6 +291,9 @@ jobs:
- put: ci-image-jdk17
params:
image: ci-image-jdk17/image.tar
+ - put: ci-image-jdk18
+ params:
+ image: ci-image-jdk18/image.tar
- name: detect-jdk-updates
plan:
- get: git-repo
@@ -294,6 +319,12 @@ jobs:
params:
<<: *github-task-params
JDK_VERSION: java17
+ - task: detect-jdk18-update
+ image: ci-image
+ file: git-repo/ci/tasks/detect-jdk-updates.yml
+ params:
+ <<: *github-task-params
+ JDK_VERSION: java18
- name: detect-ubuntu-image-updates
plan:
- get: git-repo
@@ -438,6 +469,38 @@ jobs:
- put: slack-alert
params:
<<: *slack-success-params
+- name: jdk18-build
+ serial: true
+ public: true
+ plan:
+ - get: ci-image-jdk18
+ - get: git-repo
+ trigger: true
+ - put: repo-status-jdk18-build
+ params: { state: "pending", commit: "git-repo" }
+ - do:
+ - task: build-project
+ image: ci-image-jdk18
+ privileged: true
+ timeout: ((task-timeout))
+ file: git-repo/ci/tasks/build-project.yml
+ params:
+ BRANCH: ((branch))
+ TOOLCHAIN_JAVA_VERSION: 18
+ <<: *gradle-enterprise-task-params
+ <<: *docker-hub-task-params
+ on_failure:
+ do:
+ - put: repo-status-jdk18-build
+ params: { state: "failure", commit: "git-repo" }
+ - put: slack-alert
+ params:
+ <<: *slack-fail-params
+ - put: repo-status-jdk18-build
+ params: { state: "success", commit: "git-repo" }
+ - put: slack-alert
+ params:
+ <<: *slack-success-params
- name: windows-build
serial: true
plan:
@@ -691,7 +754,7 @@ jobs:
repository: updated-homebrew-tap-repo
groups:
- name: "builds"
- jobs: ["build", "jdk11-build", "jdk17-build", "windows-build"]
+ jobs: ["build", "jdk11-build", "jdk17-build", "jdk18-build", "windows-build"]
- name: "releases"
jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "create-github-release", "publish-gradle-plugin", "publish-to-sdkman", "update-homebrew-tap"]
- name: "ci-images"
diff --git a/ci/scripts/detect-jdk-updates.sh b/ci/scripts/detect-jdk-updates.sh
index 00c55672a88f..e7cc0968cd38 100755
--- a/ci/scripts/detect-jdk-updates.sh
+++ b/ci/scripts/detect-jdk-updates.sh
@@ -20,6 +20,10 @@ case "$JDK_VERSION" in
BASE_URL="https://api.adoptium.net/v3/assets/feature_releases/17/ga"
ISSUE_TITLE="Upgrade Java 17 version in CI image"
;;
+ java18)
+ BASE_URL="https://api.adoptium.net/v3/assets/feature_releases/18/ea"
+ ISSUE_TITLE="Upgrade Java 18 version in CI image"
+ ;;
*)
echo $"Unknown java version"
exit 1;
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleCompatibilityExtension.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleCompatibilityExtension.java
index 1d8be4daf847..38296398ba35 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleCompatibilityExtension.java
+++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleCompatibilityExtension.java
@@ -47,7 +47,10 @@ final class GradleCompatibilityExtension implements TestTemplateInvocationContex
static {
JavaVersion javaVersion = JavaVersion.current();
- if (javaVersion.isCompatibleWith(JavaVersion.VERSION_17)) {
+ if (javaVersion.isCompatibleWith(JavaVersion.VERSION_HIGHER)) {
+ GRADLE_VERSIONS = Arrays.asList("7.3.3", "7.4");
+ }
+ else if (javaVersion.isCompatibleWith(JavaVersion.VERSION_17)) {
GRADLE_VERSIONS = Arrays.asList("7.2", "7.3.3", "7.4");
}
else if (javaVersion.isCompatibleWith(JavaVersion.VERSION_16)) {
diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleProjectBuilder.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleProjectBuilder.java
index 4fee624902ae..42dc5b7f223e 100644
--- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleProjectBuilder.java
+++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleProjectBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
/**
* Helper class to build Gradle {@link Project Projects} for test fixtures. Wraps
* functionality of Gradle's own {@link ProjectBuilder} in order to workaround an issue on
- * JDK 17.
+ * JDK 17 and 18.
*
* @author Christoph Dreis
* @see Gradle Support JDK 17
@@ -67,7 +67,7 @@ public Project build() {
if (StringUtils.hasText(this.name)) {
builder.withName(this.name);
}
- if (JavaVersion.current() == JavaVersion.VERSION_17) {
+ if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
NativeServices.initialize(userHome);
try {
ProjectBuilderImpl.getGlobalServices();
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java
index 455308b0dc6e..8b2d0cfbcebe 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/ArrayBinderTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2020 the original author or authors.
+ * Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@
import org.springframework.boot.context.properties.source.ConfigurationPropertyName;
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
import org.springframework.boot.context.properties.source.MockConfigurationPropertySource;
+import org.springframework.boot.testsupport.classpath.ClassPathOverrides;
import org.springframework.core.ResolvableType;
import static org.assertj.core.api.Assertions.assertThat;
@@ -44,6 +45,7 @@
* @author Phillip Webb
* @author Madhura Bhave
*/
+@ClassPathOverrides({ "org.mockito:mockito-core:4.0.0", "org.mockito:mockito-junit-jupiter:4.0.0" })
class ArrayBinderTests {
private static final Bindable> INTEGER_LIST = Bindable.listOf(Integer.class);
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java
index 0325ecd3f832..5cc98ba481ad 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BinderTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
import org.springframework.boot.context.properties.source.MockConfigurationPropertySource;
+import org.springframework.boot.testsupport.classpath.ClassPathOverrides;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.env.MapPropertySource;
@@ -63,6 +64,7 @@
* @author Phillip Webb
* @author Madhura Bhave
*/
+@ClassPathOverrides({ "org.mockito:mockito-core:4.0.0", "org.mockito:mockito-junit-jupiter:4.0.0" })
class BinderTests {
private final List sources = new ArrayList<>();
diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java
index c192379f8ba6..ddb895f66dfb 100644
--- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java
+++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2020 the original author or authors.
+ * Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
import org.springframework.boot.context.properties.source.MapConfigurationPropertySource;
import org.springframework.boot.context.properties.source.MockConfigurationPropertySource;
+import org.springframework.boot.testsupport.classpath.ClassPathOverrides;
import org.springframework.core.ResolvableType;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.support.DefaultConversionService;
@@ -59,6 +60,7 @@
* @author Phillip Webb
* @author Madhura Bhave
*/
+@ClassPathOverrides({ "org.mockito:mockito-core:4.0.0", "org.mockito:mockito-junit-jupiter:4.0.0" })
class MapBinderTests {
private static final Bindable