Replace spring-jcl with vanilla commons-logging

See gh-45487

Co-authored-by: Phillip Webb <phil.webb@broadcom.com>
This commit is contained in:
Stéphane Nicoll
2025-05-07 11:47:52 -07:00
committed by Phillip Webb
parent 111e710576
commit 6fceab2c90
19 changed files with 70 additions and 145 deletions

View File

@@ -64,7 +64,7 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
})
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-context")
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-core")
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-jcl")
.hasEntryWithNameStartingWith("BOOT-INF/lib/commons-logging")
.hasEntryWithNameStartingWith("BOOT-INF/lib/jakarta.servlet-api-6")
.hasEntryWithName("BOOT-INF/classes/org/test/SampleApplication.class")
.hasEntryWithName("org/springframework/boot/loader/launch/JarLauncher.class");
@@ -195,7 +195,7 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/")
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-context")
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-core")
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-jcl")
.hasEntryWithNameStartingWith("BOOT-INF/lib/commons-logging")
.doesNotHaveEntryWithName("BOOT-INF/lib/servlet-api-2.5.jar");
});
}
@@ -210,7 +210,7 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/")
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-context")
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-core")
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-jcl")
.hasEntryWithNameStartingWith("BOOT-INF/lib/commons-logging")
.doesNotHaveEntryWithNameStartingWith("BOOT-INF/lib/jakarta.servlet-api-");
});
}
@@ -223,7 +223,7 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
.hasEntryWithNameStartingWith("BOOT-INF/lib/jakarta.servlet-api-")
.doesNotHaveEntryWithNameStartingWith("BOOT-INF/lib/spring-context")
.doesNotHaveEntryWithNameStartingWith("BOOT-INF/lib/spring-core")
.doesNotHaveEntryWithNameStartingWith("BOOT-INF/lib/spring-jcl");
.doesNotHaveEntryWithNameStartingWith("BOOT-INF/lib/commons-logging");
});
}
@@ -238,7 +238,7 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
.hasEntryWithNameStartingWith("BOOT-INF/lib/jakarta.servlet-api-")
.doesNotHaveEntryWithNameStartingWith("BOOT-INF/lib/spring-context")
.doesNotHaveEntryWithNameStartingWith("BOOT-INF/lib/spring-core")
.doesNotHaveEntryWithNameStartingWith("BOOT-INF/lib/spring-jcl");
.doesNotHaveEntryWithNameStartingWith("BOOT-INF/lib/commons-logging");
});
}
@@ -249,7 +249,7 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/")
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-context")
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-core")
.hasEntryWithNameStartingWith("BOOT-INF/lib/spring-jcl")
.hasEntryWithNameStartingWith("BOOT-INF/lib/commons-logging")
.doesNotHaveEntryWithName("BOOT-INF/lib/log4j-api-2.4.1.jar");
});
}
@@ -491,12 +491,11 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
void whenJarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild) {
mavenBuild.project("jar-output-timestamp").execute((project) -> {
File repackaged = new File(project, "target/jar-output-timestamp-0.0.1.BUILD-SNAPSHOT.jar");
List<String> sortedLibs = Arrays.asList("BOOT-INF/lib/jakarta.servlet-api", "BOOT-INF/lib/jspecify",
"BOOT-INF/lib/micrometer-commons", "BOOT-INF/lib/micrometer-observation", "BOOT-INF/lib/spring-aop",
"BOOT-INF/lib/spring-beans",
List<String> sortedLibs = Arrays.asList("BOOT-INF/lib/commons-logging", "BOOT-INF/lib/jakarta.servlet-api",
"BOOT-INF/lib/jspecify", "BOOT-INF/lib/micrometer-commons", "BOOT-INF/lib/micrometer-observation",
"BOOT-INF/lib/spring-aop", "BOOT-INF/lib/spring-beans",
"BOOT-INF/lib/" + JarModeLibrary.TOOLS.getCoordinates().getArtifactId(),
"BOOT-INF/lib/spring-context", "BOOT-INF/lib/spring-core", "BOOT-INF/lib/spring-expression",
"BOOT-INF/lib/spring-jcl");
"BOOT-INF/lib/spring-context", "BOOT-INF/lib/spring-core", "BOOT-INF/lib/spring-expression");
assertThat(jar(repackaged)).entryNamesInPath("BOOT-INF/lib/")
.zipSatisfy(sortedLibs,
(String jarLib, String expectedLib) -> assertThat(jarLib).startsWith(expectedLib));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ class TestRunIntegrationTests {
.contains("1. " + canonicalPathOf(project, "target/test-classes"))
.contains("2. " + canonicalPathOf(project, "target/classes"))
.containsPattern("3\\. .*spring-core")
.containsPattern("4\\. .*spring-jcl"));
.containsPattern("4\\. .*commons-logging"));
}
private String canonicalPathOf(File project, String path) throws IOException {

View File

@@ -56,7 +56,7 @@ class WarIntegrationTests extends AbstractArchiveIntegrationTests {
.execute((project) -> assertThat(jar(new File(project, "target/war-0.0.1.BUILD-SNAPSHOT.war")))
.hasEntryWithNameStartingWith("WEB-INF/lib/spring-context")
.hasEntryWithNameStartingWith("WEB-INF/lib/spring-core")
.hasEntryWithNameStartingWith("WEB-INF/lib/spring-jcl")
.hasEntryWithNameStartingWith("WEB-INF/lib/commons-logging")
.hasEntryWithNameStartingWith("WEB-INF/lib-provided/jakarta.servlet-api-6")
.hasEntryWithName("org/springframework/boot/loader/launch/WarLauncher.class")
.hasEntryWithName("WEB-INF/classes/org/test/SampleApplication.class")
@@ -80,7 +80,7 @@ class WarIntegrationTests extends AbstractArchiveIntegrationTests {
.execute((project) -> assertThat(jar(new File(project, "target/war-with-unpack-0.0.1.BUILD-SNAPSHOT.war")))
.hasUnpackEntryWithNameStartingWith("WEB-INF/lib/spring-core-")
.hasEntryWithNameStartingWith("WEB-INF/lib/spring-context-")
.hasEntryWithNameStartingWith("WEB-INF/lib/spring-jcl-"));
.hasEntryWithNameStartingWith("WEB-INF/lib/commons-logging-"));
}
@TestTemplate
@@ -123,9 +123,9 @@ class WarIntegrationTests extends AbstractArchiveIntegrationTests {
List<String> sortedLibs = Arrays.asList(
// these libraries are copied from the original war, sorted when
// packaged by Maven
"WEB-INF/lib/jspecify", "WEB-INF/lib/micrometer-commons", "WEB-INF/lib/micrometer-observation",
"WEB-INF/lib/spring-aop", "WEB-INF/lib/spring-beans", "WEB-INF/lib/spring-context",
"WEB-INF/lib/spring-core", "WEB-INF/lib/spring-expression", "WEB-INF/lib/spring-jcl",
"WEB-INF/lib/commons-logging", "WEB-INF/lib/jspecify", "WEB-INF/lib/micrometer-commons",
"WEB-INF/lib/micrometer-observation", "WEB-INF/lib/spring-aop", "WEB-INF/lib/spring-beans",
"WEB-INF/lib/spring-context", "WEB-INF/lib/spring-core", "WEB-INF/lib/spring-expression",
// these libraries are contributed by Spring Boot repackaging, and
// sorted separately
"WEB-INF/lib/" + JarModeLibrary.TOOLS.getCoordinates().getArtifactId());