Skip to content

Commit 7e29a3c

Browse files
Use latest available Gradle version for Paketo system tests
This ensures that the tests will run with the latest Java versions. See spring-projectsgh-37507
1 parent a03e332 commit 7e29a3c

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ public static String minimumCompatible() {
4444
return allCompatible().get(0);
4545
}
4646

47+
public static String maximumCompatible() {
48+
List<String> versions = allCompatible();
49+
return versions.get(versions.size() - 1);
50+
}
51+
4752
private static boolean isJavaVersion(JavaVersion version) {
4853
return JavaVersion.current().isCompatibleWith(version);
4954
}

spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/paketo/PaketoBuilderTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import org.springframework.boot.image.junit.GradleBuildInjectionExtension;
4747
import org.springframework.boot.testsupport.gradle.testkit.GradleBuild;
4848
import org.springframework.boot.testsupport.gradle.testkit.GradleBuildExtension;
49+
import org.springframework.boot.testsupport.gradle.testkit.GradleVersions;
4950
import org.springframework.util.StringUtils;
5051

5152
import static org.assertj.core.api.Assertions.assertThat;
@@ -72,6 +73,7 @@ void configureGradleBuild() {
7273
this.gradleBuild.scriptPropertyFrom(new File("../../gradle.properties"), "nativeBuildToolsVersion");
7374
this.gradleBuild.expectDeprecationMessages("BPL_SPRING_CLOUD_BINDINGS_ENABLED.*true.*Deprecated");
7475
this.gradleBuild.expectDeprecationMessages("BOM table is deprecated");
76+
this.gradleBuild.gradleVersion(GradleVersions.maximumCompatible());
7577
}
7678

7779
@Test
@@ -298,6 +300,9 @@ void plainWarApp() throws Exception {
298300
@EnabledForJreRange(max = JRE.JAVA_17)
299301
void nativeApp() throws Exception {
300302
this.gradleBuild.expectDeprecationMessages("uses or overrides a deprecated API");
303+
// these deprecations are transitive from the Native Build Tools Gradle plugin
304+
this.gradleBuild.expectDeprecationMessages("has been deprecated. This is scheduled to be removed in Gradle 9.0");
305+
this.gradleBuild.expectDeprecationMessages("upgrading_version_8.html#deprecated_access_to_convention");
301306
writeMainClass();
302307
String imageName = "paketo-integration/" + this.gradleBuild.getProjectDir().getName();
303308
ImageReference imageReference = ImageReference.of(ImageName.of(imageName));

spring-boot-system-tests/spring-boot-image-tests/src/systemTest/resources/org/springframework/boot/image/paketo/PaketoBuilderTests-bootDistZipJarApp.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ application {
3939
bootBuildImage {
4040
builder = "paketobuildpacks/builder-jammy-base:latest"
4141
archiveFile = bootDistZip.archiveFile
42-
environment = ['BP_JVM_VERSION': project.targetCompatibility.getMajorVersion()]
42+
environment = ['BP_JVM_VERSION': java.targetCompatibility.getMajorVersion()]
4343
}

spring-boot-system-tests/spring-boot-image-tests/src/systemTest/resources/org/springframework/boot/image/paketo/PaketoBuilderTests-plainDistZipJarApp.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ application {
3939
bootBuildImage {
4040
builder = "paketobuildpacks/builder-jammy-base:latest"
4141
archiveFile = distZip.archiveFile
42-
environment = ['BP_JVM_VERSION': project.targetCompatibility.getMajorVersion()]
42+
environment = ['BP_JVM_VERSION': java.targetCompatibility.getMajorVersion()]
4343
}

spring-boot-system-tests/spring-boot-image-tests/src/systemTest/resources/org/springframework/boot/image/paketo/PaketoBuilderTests-plainWarApp.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ war {
3232
bootBuildImage {
3333
builder = "paketobuildpacks/builder-jammy-base:latest"
3434
archiveFile = war.archiveFile
35-
environment = ['BP_JVM_VERSION': project.targetCompatibility.getMajorVersion(), 'BP_TOMCAT_VERSION': '10.*']
35+
environment = ['BP_JVM_VERSION': java.targetCompatibility.getMajorVersion(), 'BP_TOMCAT_VERSION': '10.*']
3636
}

0 commit comments

Comments
 (0)