mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Restore additional repositories for docker tests
This commit reverts partially what was done in gh-49397 to let docker tests have access to additional maven repositories. Unfortunately, maven build executions with the Spring Boot Maven Plugin do not use the BOM for dependency management. As such, if one of the dependency requires a dependency that has not been prepared in the local repository, it will need to be able to download it from the relevant repository. This is the case with spring-core that the maven plugin depends on when Spring Framework and Spring Boot do not use the same Micrometer version: the build prepares the version that Spring Boot uses, but the build execution attempts to download the one that Spring Framework relies on. Closes gh-51266
This commit is contained in:
@@ -108,15 +108,21 @@ tasks.named("checkCompileClasspathForProhibitedDependencies") {
|
||||
permittedGroups = ["javax.inject"]
|
||||
}
|
||||
|
||||
tasks.register("copySettingsXml", Copy) {
|
||||
from file("src/intTest/projects/settings.xml")
|
||||
into layout.buildDirectory.dir("generated-resources/settings")
|
||||
filter(springRepositoryTransformers.mavenSettings())
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
output.dir(layout.buildDirectory.dir("generated/resources/xsd"), builtBy: "xsdResources")
|
||||
}
|
||||
intTest {
|
||||
output.dir(layout.buildDirectory.dir("generated-resources"), builtBy: ["extractVersionProperties"])
|
||||
output.dir(layout.buildDirectory.dir("generated-resources"), builtBy: ["extractVersionProperties", "copySettingsXml"])
|
||||
}
|
||||
dockerTest {
|
||||
output.dir(layout.buildDirectory.dir("generated-resources"), builtBy: "extractVersionProperties")
|
||||
output.dir(layout.buildDirectory.dir("generated-resources"), builtBy: ["extractVersionProperties", "copySettingsXml"])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -69,6 +69,8 @@ class MavenBuild {
|
||||
|
||||
private final Properties properties = new Properties();
|
||||
|
||||
private String root = "intTest";
|
||||
|
||||
private @Nullable ProjectCallback preparation;
|
||||
|
||||
private @Nullable File projectDir;
|
||||
@@ -102,6 +104,7 @@ class MavenBuild {
|
||||
}
|
||||
|
||||
MavenBuild project(String root, String project) {
|
||||
this.root = root;
|
||||
this.projectDir = new File("src/" + root + "/projects/" + project);
|
||||
return this;
|
||||
}
|
||||
@@ -163,7 +166,10 @@ class MavenBuild {
|
||||
}
|
||||
|
||||
});
|
||||
String settingsXml = Files.readString(Paths.get("src", "intTest", "projects", "settings.xml"))
|
||||
Path settingsXmlPath = "dockerTest".equals(this.root)
|
||||
? Paths.get("build", "generated-resources", "settings", "settings.xml")
|
||||
: Paths.get("src", "intTest", "projects", "settings.xml");
|
||||
String settingsXml = Files.readString(settingsXmlPath)
|
||||
.replace("@localCentralUrl@", new File("build/test-maven-repository").toURI().toURL().toString())
|
||||
.replace("@localRepositoryPath@", new File("build/local-maven-repository").getAbsolutePath());
|
||||
Files.writeString(destination.resolve("settings.xml"), settingsXml, StandardOpenOption.CREATE_NEW);
|
||||
|
||||
Reference in New Issue
Block a user