Update CNB buildpack Java version env variable

Prior to this commit, the build tool plugins set the environment
variable BP_JAVA_VERSION when invoking the CNB builder to set the
version of the JDK/JRE that the builder should use in the created
image.

With CNB API 0.3, the convention changed the name of this environment
variable to BP_JVM_VERSION. This commit updates the build tool
plugins to match the newer convention.

See gh-21273
This commit is contained in:
Scott Frederick
2020-05-08 17:07:51 -05:00
parent 35bc82a693
commit 28749e7fbb
9 changed files with 17 additions and 17 deletions

View File

@@ -131,15 +131,15 @@ class BootBuildImageTests {
@Test
void whenJavaVersionIsSetInEnvironmentItIsIncludedInTheRequest() {
this.buildImage.environment("BP_JAVA_VERSION", "from-env");
this.buildImage.environment("BP_JVM_VERSION", "from-env");
this.buildImage.getTargetJavaVersion().set(JavaVersion.VERSION_1_8);
assertThat(this.buildImage.createRequest().getEnv()).containsEntry("BP_JAVA_VERSION", "from-env").hasSize(1);
assertThat(this.buildImage.createRequest().getEnv()).containsEntry("BP_JVM_VERSION", "from-env").hasSize(1);
}
@Test
void whenTargetCompatibilityIsSetThenJavaVersionIsIncludedInTheRequest() {
this.buildImage.getTargetJavaVersion().set(JavaVersion.VERSION_1_8);
assertThat(this.buildImage.createRequest().getEnv()).containsEntry("BP_JAVA_VERSION", "8.*").hasSize(1);
assertThat(this.buildImage.createRequest().getEnv()).containsEntry("BP_JVM_VERSION", "8.*").hasSize(1);
}
@Test
@@ -147,7 +147,7 @@ class BootBuildImageTests {
this.buildImage.environment("ALPHA", "a");
this.buildImage.getTargetJavaVersion().set(JavaVersion.VERSION_11);
assertThat(this.buildImage.createRequest().getEnv()).containsEntry("ALPHA", "a")
.containsEntry("BP_JAVA_VERSION", "11.*").hasSize(2);
.containsEntry("BP_JVM_VERSION", "11.*").hasSize(2);
}
@Test