mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Update spring-boot-maven-plugin to use docker-test plugin
See gh-41228
This commit is contained in:
parent
7d5a761d51
commit
89a06608d2
@ -3,6 +3,7 @@ plugins {
|
|||||||
id "org.springframework.boot.conventions"
|
id "org.springframework.boot.conventions"
|
||||||
id "org.springframework.boot.maven-plugin"
|
id "org.springframework.boot.maven-plugin"
|
||||||
id "org.springframework.boot.optional-dependencies"
|
id "org.springframework.boot.optional-dependencies"
|
||||||
|
id "org.springframework.boot.docker-test"
|
||||||
}
|
}
|
||||||
|
|
||||||
description = "Spring Boot Maven Plugin"
|
description = "Spring Boot Maven Plugin"
|
||||||
@ -25,6 +26,15 @@ dependencies {
|
|||||||
exclude(group: "javax.enterprise", module: "cdi-api")
|
exclude(group: "javax.enterprise", module: "cdi-api")
|
||||||
exclude(group: "javax.inject", module: "javax.inject")
|
exclude(group: "javax.inject", module: "javax.inject")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||||
|
dockerTestImplementation("org.apache.maven.shared:maven-invoker") {
|
||||||
|
exclude(group: "javax.inject", module: "javax.inject")
|
||||||
|
}
|
||||||
|
dockerTestImplementation("org.assertj:assertj-core")
|
||||||
|
dockerTestImplementation("org.junit.jupiter:junit-jupiter")
|
||||||
|
dockerTestImplementation("org.testcontainers:junit-jupiter")
|
||||||
|
dockerTestImplementation("org.testcontainers:testcontainers")
|
||||||
|
|
||||||
implementation(project(":spring-boot-project:spring-boot-tools:spring-boot-buildpack-platform"))
|
implementation(project(":spring-boot-project:spring-boot-tools:spring-boot-buildpack-platform"))
|
||||||
implementation(project(":spring-boot-project:spring-boot-tools:spring-boot-loader-tools"))
|
implementation(project(":spring-boot-project:spring-boot-tools:spring-boot-loader-tools"))
|
||||||
@ -47,8 +57,6 @@ dependencies {
|
|||||||
}
|
}
|
||||||
intTestImplementation("org.assertj:assertj-core")
|
intTestImplementation("org.assertj:assertj-core")
|
||||||
intTestImplementation("org.junit.jupiter:junit-jupiter")
|
intTestImplementation("org.junit.jupiter:junit-jupiter")
|
||||||
intTestImplementation("org.testcontainers:testcontainers")
|
|
||||||
intTestImplementation("org.testcontainers:junit-jupiter")
|
|
||||||
|
|
||||||
mavenOptionalImplementation("org.apache.maven.plugins:maven-shade-plugin") {
|
mavenOptionalImplementation("org.apache.maven.plugins:maven-shade-plugin") {
|
||||||
exclude(group: "javax.annotation", module: "javax.annotation-api")
|
exclude(group: "javax.annotation", module: "javax.annotation-api")
|
||||||
@ -97,6 +105,9 @@ sourceSets {
|
|||||||
intTest {
|
intTest {
|
||||||
output.dir("${buildDir}/generated-resources", builtBy: "extractVersionProperties")
|
output.dir("${buildDir}/generated-resources", builtBy: "extractVersionProperties")
|
||||||
}
|
}
|
||||||
|
dockerTest {
|
||||||
|
output.dir("${buildDir}/generated-resources", builtBy: "extractVersionProperties")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) {
|
tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) {
|
||||||
@ -180,3 +191,7 @@ tasks.named("documentPluginGoals") {
|
|||||||
"test-run": "run"
|
"test-run": "run"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.named("dockerTest").configure {
|
||||||
|
dependsOn tasks.named("prepareMavenBinaries")
|
||||||
|
}
|
||||||
|
@ -61,7 +61,7 @@ class BuildImageRegistryIntegrationTests extends AbstractArchiveIntegrationTests
|
|||||||
void whenBuildImageIsInvokedWithPublish(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithPublish(MavenBuild mavenBuild) {
|
||||||
String repoName = "test-image";
|
String repoName = "test-image";
|
||||||
String imageName = this.registryAddress + "/" + repoName;
|
String imageName = this.registryAddress + "/" + repoName;
|
||||||
mavenBuild.project("build-image-publish")
|
mavenBuild.project("dockerTest", "build-image-publish")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.imageName", imageName)
|
.systemProperty("spring-boot.build-image.imageName", imageName)
|
||||||
.execute((project) -> {
|
.execute((project) -> {
|
@ -57,7 +57,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithoutRepackageTheArchiveIsRepackagedOnTheFly(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithoutRepackageTheArchiveIsRepackagedOnTheFly(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image")
|
mavenBuild.project("dockerTest", "build-image")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.prepare(this::writeLongNameResource)
|
.prepare(this::writeLongNameResource)
|
||||||
@ -77,7 +77,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedOnTheCommandLineWithoutRepackageTheArchiveIsRepackagedOnTheFly(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedOnTheCommandLineWithoutRepackageTheArchiveIsRepackagedOnTheFly(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-cmd-line")
|
mavenBuild.project("dockerTest", "build-image-cmd-line")
|
||||||
.goals("spring-boot:build-image")
|
.goals("spring-boot:build-image")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.prepare(this::writeLongNameResource)
|
.prepare(this::writeLongNameResource)
|
||||||
@ -97,7 +97,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithClassifierWithoutRepackageTheArchiveIsRepackagedOnTheFly(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithClassifierWithoutRepackageTheArchiveIsRepackagedOnTheFly(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-classifier")
|
mavenBuild.project("dockerTest", "build-image-classifier")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.prepare(this::writeLongNameResource)
|
.prepare(this::writeLongNameResource)
|
||||||
@ -118,7 +118,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithClassifierSourceWithoutRepackageTheArchiveIsRepackagedOnTheFly(
|
void whenBuildImageIsInvokedWithClassifierSourceWithoutRepackageTheArchiveIsRepackagedOnTheFly(
|
||||||
MavenBuild mavenBuild) {
|
MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-classifier-source")
|
mavenBuild.project("dockerTest", "build-image-classifier-source")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.prepare(this::writeLongNameResource)
|
.prepare(this::writeLongNameResource)
|
||||||
@ -139,7 +139,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithRepackageTheExistingArchiveIsUsed(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithRepackageTheExistingArchiveIsUsed(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-with-repackage")
|
mavenBuild.project("dockerTest", "build-image-with-repackage")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.prepare(this::writeLongNameResource)
|
.prepare(this::writeLongNameResource)
|
||||||
@ -160,7 +160,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithClassifierAndRepackageTheExistingArchiveIsUsed(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithClassifierAndRepackageTheExistingArchiveIsUsed(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-classifier-with-repackage")
|
mavenBuild.project("dockerTest", "build-image-classifier-with-repackage")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.prepare(this::writeLongNameResource)
|
.prepare(this::writeLongNameResource)
|
||||||
@ -181,7 +181,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithClassifierSourceAndRepackageTheExistingArchiveIsUsed(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithClassifierSourceAndRepackageTheExistingArchiveIsUsed(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-classifier-source-with-repackage")
|
mavenBuild.project("dockerTest", "build-image-classifier-source-with-repackage")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.prepare(this::writeLongNameResource)
|
.prepare(this::writeLongNameResource)
|
||||||
@ -203,7 +203,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithWarPackaging(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithWarPackaging(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-war-packaging")
|
mavenBuild.project("dockerTest", "build-image-war-packaging")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.prepare(this::writeLongNameResource)
|
.prepare(this::writeLongNameResource)
|
||||||
@ -223,7 +223,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithCustomImageName(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithCustomImageName(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-custom-name")
|
mavenBuild.project("dockerTest", "build-image-custom-name")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.systemProperty("spring-boot.build-image.imageName", "example.com/test/property-ignored:pom-preferred")
|
.systemProperty("spring-boot.build-image.imageName", "example.com/test/property-ignored:pom-preferred")
|
||||||
@ -243,7 +243,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithCommandLineParameters(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithCommandLineParameters(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image")
|
mavenBuild.project("dockerTest", "build-image")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.systemProperty("spring-boot.build-image.imageName", "example.com/test/cmd-property-name:v1")
|
.systemProperty("spring-boot.build-image.imageName", "example.com/test/cmd-property-name:v1")
|
||||||
@ -266,7 +266,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithCustomBuilderImageAndRunImage(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithCustomBuilderImageAndRunImage(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-custom-builder")
|
mavenBuild.project("dockerTest", "build-image-custom-builder")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.execute((project) -> {
|
.execute((project) -> {
|
||||||
@ -281,7 +281,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithEmptyEnvEntry(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithEmptyEnvEntry(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-empty-env-entry")
|
mavenBuild.project("dockerTest", "build-image-empty-env-entry")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.prepare(this::writeLongNameResource)
|
.prepare(this::writeLongNameResource)
|
||||||
@ -297,7 +297,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithZipPackaging(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithZipPackaging(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-zip-packaging")
|
mavenBuild.project("dockerTest", "build-image-zip-packaging")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.prepare(this::writeLongNameResource)
|
.prepare(this::writeLongNameResource)
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
@ -314,7 +314,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithBuildpacks(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithBuildpacks(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-custom-buildpacks")
|
mavenBuild.project("dockerTest", "build-image-custom-buildpacks")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.execute((project) -> {
|
.execute((project) -> {
|
||||||
@ -327,7 +327,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithBinding(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithBinding(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-bindings")
|
mavenBuild.project("dockerTest", "build-image-bindings")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.execute((project) -> {
|
.execute((project) -> {
|
||||||
@ -342,7 +342,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithNetworkModeNone(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithNetworkModeNone(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-network")
|
mavenBuild.project("dockerTest", "build-image-network")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.execute((project) -> {
|
.execute((project) -> {
|
||||||
@ -356,7 +356,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedOnMultiModuleProjectWithPackageGoal(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedOnMultiModuleProjectWithPackageGoal(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-multi-module")
|
mavenBuild.project("dockerTest", "build-image-multi-module")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.execute((project) -> {
|
.execute((project) -> {
|
||||||
@ -369,7 +369,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithTags(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithTags(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-tags")
|
mavenBuild.project("dockerTest", "build-image-tags")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.execute((project) -> {
|
.execute((project) -> {
|
||||||
@ -386,7 +386,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithVolumeCaches(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithVolumeCaches(MavenBuild mavenBuild) {
|
||||||
String testBuildId = randomString();
|
String testBuildId = randomString();
|
||||||
mavenBuild.project("build-image-volume-caches")
|
mavenBuild.project("dockerTest", "build-image-volume-caches")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.systemProperty("test-build-id", testBuildId)
|
.systemProperty("test-build-id", testBuildId)
|
||||||
@ -404,7 +404,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
+ "Docker Desktop on other OSs")
|
+ "Docker Desktop on other OSs")
|
||||||
void whenBuildImageIsInvokedWithBindCaches(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithBindCaches(MavenBuild mavenBuild) {
|
||||||
String testBuildId = randomString();
|
String testBuildId = randomString();
|
||||||
mavenBuild.project("build-image-bind-caches")
|
mavenBuild.project("dockerTest", "build-image-bind-caches")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.systemProperty("test-build-id", testBuildId)
|
.systemProperty("test-build-id", testBuildId)
|
||||||
@ -435,7 +435,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithCreatedDate(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithCreatedDate(MavenBuild mavenBuild) {
|
||||||
String testBuildId = randomString();
|
String testBuildId = randomString();
|
||||||
mavenBuild.project("build-image-created-date")
|
mavenBuild.project("dockerTest", "build-image-created-date")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.systemProperty("test-build-id", testBuildId)
|
.systemProperty("test-build-id", testBuildId)
|
||||||
@ -453,7 +453,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithCurrentCreatedDate(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithCurrentCreatedDate(MavenBuild mavenBuild) {
|
||||||
String testBuildId = randomString();
|
String testBuildId = randomString();
|
||||||
mavenBuild.project("build-image-current-created-date")
|
mavenBuild.project("dockerTest", "build-image-current-created-date")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.systemProperty("test-build-id", testBuildId)
|
.systemProperty("test-build-id", testBuildId)
|
||||||
@ -476,7 +476,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithApplicationDirectory(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithApplicationDirectory(MavenBuild mavenBuild) {
|
||||||
String testBuildId = randomString();
|
String testBuildId = randomString();
|
||||||
mavenBuild.project("build-image-app-dir")
|
mavenBuild.project("dockerTest", "build-image-app-dir")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.systemProperty("test-build-id", testBuildId)
|
.systemProperty("test-build-id", testBuildId)
|
||||||
@ -491,7 +491,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
@TestTemplate
|
@TestTemplate
|
||||||
void whenBuildImageIsInvokedWithEmptySecurityOptions(MavenBuild mavenBuild) {
|
void whenBuildImageIsInvokedWithEmptySecurityOptions(MavenBuild mavenBuild) {
|
||||||
String testBuildId = randomString();
|
String testBuildId = randomString();
|
||||||
mavenBuild.project("build-image-security-opts")
|
mavenBuild.project("dockerTest", "build-image-security-opts")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.systemProperty("test-build-id", testBuildId)
|
.systemProperty("test-build-id", testBuildId)
|
||||||
@ -505,7 +505,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void failsWhenBuildImageIsInvokedOnMultiModuleProjectWithBuildImageGoal(MavenBuild mavenBuild) {
|
void failsWhenBuildImageIsInvokedOnMultiModuleProjectWithBuildImageGoal(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-multi-module")
|
mavenBuild.project("dockerTest", "build-image-multi-module")
|
||||||
.goals("spring-boot:build-image")
|
.goals("spring-boot:build-image")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.executeAndFail((project) -> assertThat(buildLog(project)).contains("Error packaging archive for image"));
|
.executeAndFail((project) -> assertThat(buildLog(project)).contains("Error packaging archive for image"));
|
||||||
@ -513,7 +513,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void failsWhenBuilderFails(MavenBuild mavenBuild) {
|
void failsWhenBuilderFails(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-builder-error")
|
mavenBuild.project("dockerTest", "build-image-builder-error")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.executeAndFail((project) -> assertThat(buildLog(project)).contains("Building image")
|
.executeAndFail((project) -> assertThat(buildLog(project)).contains("Building image")
|
||||||
@ -524,7 +524,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void failsWithBuildpackNotInBuilder(MavenBuild mavenBuild) {
|
void failsWithBuildpackNotInBuilder(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-bad-buildpack")
|
mavenBuild.project("dockerTest", "build-image-bad-buildpack")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
.systemProperty("spring-boot.build-image.pullPolicy", "IF_NOT_PRESENT")
|
||||||
.executeAndFail((project) -> assertThat(buildLog(project))
|
.executeAndFail((project) -> assertThat(buildLog(project))
|
||||||
@ -533,7 +533,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void failsWhenFinalNameIsMisconfigured(MavenBuild mavenBuild) {
|
void failsWhenFinalNameIsMisconfigured(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-final-name")
|
mavenBuild.project("dockerTest", "build-image-final-name")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.executeAndFail((project) -> assertThat(buildLog(project)).contains("final-name.jar.original")
|
.executeAndFail((project) -> assertThat(buildLog(project)).contains("final-name.jar.original")
|
||||||
.contains("is required for building an image"));
|
.contains("is required for building an image"));
|
||||||
@ -541,7 +541,7 @@ class BuildImageTests extends AbstractArchiveIntegrationTests {
|
|||||||
|
|
||||||
@TestTemplate
|
@TestTemplate
|
||||||
void failsWhenCachesAreConfiguredTwice(MavenBuild mavenBuild) {
|
void failsWhenCachesAreConfiguredTwice(MavenBuild mavenBuild) {
|
||||||
mavenBuild.project("build-image-caches-multiple")
|
mavenBuild.project("dockerTest", "build-image-caches-multiple")
|
||||||
.goals("package")
|
.goals("package")
|
||||||
.executeAndFail((project) -> assertThat(buildLog(project))
|
.executeAndFail((project) -> assertThat(buildLog(project))
|
||||||
.contains("Each image building cache can be configured only once"));
|
.contains("Each image building cache can be configured only once"));
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -37,7 +37,7 @@ class EclipseM2eIntegrationTests {
|
|||||||
@Test // gh-21992
|
@Test // gh-21992
|
||||||
void pluginPomIncludesOptionalShadeDependency() throws Exception {
|
void pluginPomIncludesOptionalShadeDependency() throws Exception {
|
||||||
String version = new Versions().get("project.version");
|
String version = new Versions().get("project.version");
|
||||||
File repository = new File("build/int-test-maven-repository");
|
File repository = new File("build/test-maven-repository");
|
||||||
File pluginDirectory = new File(repository, "org/springframework/boot/spring-boot-maven-plugin/" + version);
|
File pluginDirectory = new File(repository, "org/springframework/boot/spring-boot-maven-plugin/" + version);
|
||||||
File[] pomFiles = pluginDirectory.listFiles(this::isPomFile);
|
File[] pomFiles = pluginDirectory.listFiles(this::isPomFile);
|
||||||
Arrays.sort(pomFiles, Comparator.comparing(File::getName));
|
Arrays.sort(pomFiles, Comparator.comparing(File::getName));
|
||||||
|
@ -96,7 +96,11 @@ class MavenBuild {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MavenBuild project(String project) {
|
MavenBuild project(String project) {
|
||||||
this.projectDir = new File("src/intTest/projects/" + project);
|
return project("intTest", project);
|
||||||
|
}
|
||||||
|
|
||||||
|
MavenBuild project(String root, String project) {
|
||||||
|
this.projectDir = new File("src/" + root + "/projects/" + project);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +161,7 @@ class MavenBuild {
|
|||||||
|
|
||||||
});
|
});
|
||||||
String settingsXml = Files.readString(Paths.get("src", "intTest", "projects", "settings.xml"))
|
String settingsXml = Files.readString(Paths.get("src", "intTest", "projects", "settings.xml"))
|
||||||
.replace("@localCentralUrl@", new File("build/int-test-maven-repository").toURI().toURL().toString())
|
.replace("@localCentralUrl@", new File("build/test-maven-repository").toURI().toURL().toString())
|
||||||
.replace("@localRepositoryPath@", new File("build/local-maven-repository").getAbsolutePath());
|
.replace("@localRepositoryPath@", new File("build/local-maven-repository").getAbsolutePath());
|
||||||
Files.writeString(destination.resolve("settings.xml"), settingsXml, StandardOpenOption.CREATE_NEW);
|
Files.writeString(destination.resolve("settings.xml"), settingsXml, StandardOpenOption.CREATE_NEW);
|
||||||
request.setBaseDirectory(this.temp);
|
request.setBaseDirectory(this.temp);
|
||||||
|
Loading…
Reference in New Issue
Block a user