Use NBT plugin version from gradle.properties in image tests

See gh-32643
pull/32740/head
Johnny Lim 2 years ago committed by Scott Frederick
parent fc93e6bf8b
commit 42ab82c0b1

@ -17,6 +17,7 @@
package org.springframework.boot.image.paketo; package org.springframework.boot.image.paketo;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -24,6 +25,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Properties;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.jar.Attributes; import java.util.jar.Attributes;
@ -68,13 +70,22 @@ class PaketoBuilderTests {
GradleBuild gradleBuild; GradleBuild gradleBuild;
@BeforeEach @BeforeEach
void configureGradleBuild() { void configureGradleBuild() throws IOException {
this.gradleBuild.scriptProperty("systemTestMavenRepository", this.gradleBuild.scriptProperty("systemTestMavenRepository",
new File("build/system-test-maven-repository").getAbsoluteFile().toURI().toASCIIString()); new File("build/system-test-maven-repository").getAbsoluteFile().toURI().toASCIIString());
this.gradleBuild.scriptProperty("nativeBuildToolsVersion", getNativeBuildToolsVersion());
this.gradleBuild.expectDeprecationMessages("BPL_SPRING_CLOUD_BINDINGS_ENABLED.*true.*Deprecated"); this.gradleBuild.expectDeprecationMessages("BPL_SPRING_CLOUD_BINDINGS_ENABLED.*true.*Deprecated");
this.gradleBuild.expectDeprecationMessages("BOM table is deprecated"); this.gradleBuild.expectDeprecationMessages("BOM table is deprecated");
} }
private String getNativeBuildToolsVersion() throws IOException {
Properties gradleProperties = new Properties();
try (FileInputStream input = new FileInputStream("../../gradle.properties")) {
gradleProperties.load(input);
return gradleProperties.getProperty("nativeBuildToolsVersion");
}
}
@Test @Test
void executableJarApp() throws Exception { void executableJarApp() throws Exception {
writeMainClass(); writeMainClass();

@ -2,7 +2,7 @@ plugins {
id 'org.springframework.boot' version '{bootVersion}' id 'org.springframework.boot' version '{bootVersion}'
id 'org.springframework.boot.aot' version '{bootVersion}' id 'org.springframework.boot.aot' version '{bootVersion}'
id 'io.spring.dependency-management' version '{dependencyManagementPluginVersion}' id 'io.spring.dependency-management' version '{dependencyManagementPluginVersion}'
id 'org.graalvm.buildtools.native' version '0.9.14' id 'org.graalvm.buildtools.native' version '{nativeBuildToolsVersion}'
id 'java' id 'java'
} }

Loading…
Cancel
Save