Skip to content

Commit a80f1af

Browse files
committed
Merge branch '2.4.x'
Closes gh-25463
2 parents 782f838 + 06b2640 commit a80f1af

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-publish.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ bootBuildImage {
2121
}
2222
}
2323
// end::publish[]
24+
25+
task bootBuildImagePublish {
26+
doFirst {
27+
println(tasks.bootBuildImage.publish)
28+
}
29+
}

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-publish.gradle.kts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tasks.getByName<BootJar>("bootJar") {
1313
// tag::publish[]
1414
tasks.getByName<BootBuildImage>("bootBuildImage") {
1515
imageName = "docker.example.com/library/${project.name}"
16-
publish = true
16+
isPublish = true
1717
docker {
1818
publishRegistry {
1919
username = "user"
@@ -24,3 +24,9 @@ tasks.getByName<BootBuildImage>("bootBuildImage") {
2424
}
2525
}
2626
// end::publish[]
27+
28+
tasks.register("bootBuildImagePublish") {
29+
doFirst {
30+
println(tasks.getByName<BootBuildImage>("bootBuildImage").isPublish)
31+
}
32+
}

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PackagingDocumentationTests.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -242,6 +242,13 @@ void bootBuildImageWithCustomImageName() throws IOException {
242242
assertThat(result.getOutput()).contains("example.com/library/" + this.gradleBuild.getProjectDir().getName());
243243
}
244244

245+
@TestTemplate
246+
void bootBuildImagePublish() throws IOException {
247+
BuildResult result = this.gradleBuild.script("src/docs/gradle/packaging/boot-build-image-publish")
248+
.build("bootBuildImagePublish");
249+
assertThat(result.getOutput()).contains("true");
250+
}
251+
245252
protected void jarFile(File file) throws IOException {
246253
try (JarOutputStream jar = new JarOutputStream(new FileOutputStream(file))) {
247254
jar.putNextEntry(new ZipEntry("META-INF/MANIFEST.MF"));

0 commit comments

Comments
 (0)