Skip to content

Commit 5ae533a

Browse files
committed
Minimize scope of version management for commons-compress
See gh-39368
1 parent 84e390a commit 5ae533a

File tree

7 files changed

+37
-15
lines changed

7 files changed

+37
-15
lines changed

gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
66

77
assertjVersion=3.24.2
88
commonsCodecVersion=1.16.0
9+
commonsCompressVersion=1.21
910
hamcrestVersion=2.2
1011
jacksonVersion=2.15.3
1112
junitJupiterVersion=5.10.1

spring-boot-project/spring-boot-parent/build.gradle

-7
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@ bom {
3434
]
3535
}
3636
}
37-
library("Commons Compress", "1.21") {
38-
group("org.apache.commons") {
39-
modules = [
40-
"commons-compress"
41-
]
42-
}
43-
}
4437
library("Commons FileUpload", "1.5") {
4538
group("commons-fileupload") {
4639
modules = [

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/build.gradle

+12-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ configurations.all {
1919
if (dependency.requested.group.equals("org.springframework")) {
2020
dependency.useVersion("6.0.10")
2121
}
22+
// We manage the version of commons-compress here rather than
23+
// in spring-boot-parent to minimize conflicts with Testcontainers
24+
if (dependency.requested.group.equals("org.apache.commons")
25+
&& dependency.requested.name.equals("commons-compress")) {
26+
dependency.useVersion("$commonsCompressVersion")
27+
}
28+
// Downgrade Testcontainers for compatibility with the managed
29+
// version of Commons Compress.
30+
if (dependency.requested.group.equals("org.testcontainers")) {
31+
dependency.useVersion("1.19.3")
32+
}
2233
}
2334
}
2435
}
@@ -27,7 +38,7 @@ dependencies {
2738
api("com.fasterxml.jackson.core:jackson-databind")
2839
api("com.fasterxml.jackson.module:jackson-module-parameter-names")
2940
api("net.java.dev.jna:jna-platform")
30-
api("org.apache.commons:commons-compress")
41+
api("org.apache.commons:commons-compress:$commonsCompressVersion")
3142
api("org.apache.httpcomponents.client5:httpclient5")
3243
api("org.springframework:spring-core")
3344
api("org.tomlj:tomlj:1.0.0")

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle

+12-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ configurations {
2828
if (dependency.requested.group.equals("org.springframework")) {
2929
dependency.useVersion("6.0.10")
3030
}
31+
// We manage the version of commons-compress here rather than
32+
// in spring-boot-parent to minimize conflicts with Testcontainers
33+
if (dependency.requested.group.equals("org.apache.commons")
34+
&& dependency.requested.name.equals("commons-compress")) {
35+
dependency.useVersion("$commonsCompressVersion")
36+
}
37+
// Downgrade Testcontainers for compatibility with the managed
38+
// version of Commons Compress.
39+
if (dependency.requested.group.equals("org.testcontainers")) {
40+
dependency.useVersion("1.19.3")
41+
}
3142
}
3243
}
3344
}
@@ -39,7 +50,7 @@ dependencies {
3950
implementation(project(":spring-boot-project:spring-boot-tools:spring-boot-buildpack-platform"))
4051
implementation(project(":spring-boot-project:spring-boot-tools:spring-boot-loader-tools"))
4152
implementation("io.spring.gradle:dependency-management-plugin")
42-
implementation("org.apache.commons:commons-compress")
53+
implementation("org.apache.commons:commons-compress:$commonsCompressVersion")
4354
implementation("org.springframework:spring-core")
4455

4556
optional("org.graalvm.buildtools:native-gradle-plugin")

spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies {
1717
implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlinVersion")
1818
implementation("org.jetbrains.kotlin:kotlin-compiler-runner:$kotlinVersion")
1919
implementation("org.jetbrains.kotlin:kotlin-daemon-client:$kotlinVersion")
20-
implementation("org.apache.commons:commons-compress")
20+
implementation("org.apache.commons:commons-compress:$commonsCompressVersion")
2121

2222
implementation("org.assertj:assertj-core")
2323
}

spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle

+7-1
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,19 @@ configurations {
2929
if (dependency.requested.group.equals("org.springframework")) {
3030
dependency.useVersion("6.0.10")
3131
}
32+
// We manage the version of commons-compress here rather than
33+
// in spring-boot-parent to minimize conflicts with Testcontainers
34+
if (dependency.requested.group.equals("org.apache.commons")
35+
&& dependency.requested.name.equals("commons-compress")) {
36+
dependency.useVersion("$commonsCompressVersion")
37+
}
3238
}
3339
}
3440
}
3541
}
3642

3743
dependencies {
38-
api("org.apache.commons:commons-compress")
44+
api("org.apache.commons:commons-compress:$commonsCompressVersion")
3945
api("org.springframework:spring-core")
4046

4147
compileOnly("ch.qos.logback:logback-classic")

spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/assertions/ImageAssert.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ public ListAssert<String> entries() {
8080
this.actual.writeTo(out);
8181
try (TarArchiveInputStream in = new TarArchiveInputStream(
8282
new ByteArrayInputStream(out.toByteArray()))) {
83-
TarArchiveEntry entry = in.getNextTarEntry();
83+
TarArchiveEntry entry = in.getNextEntry();
8484
while (entry != null) {
8585
if (!entry.isDirectory()) {
8686
entryNames.add(entry.getName().replaceFirst("^/workspace/", ""));
8787
}
88-
entry = in.getNextTarEntry();
88+
entry = in.getNextEntry();
8989
}
9090
}
9191
}
@@ -101,15 +101,15 @@ public void jsonEntry(String name, Consumer<JsonContentAssert> assertConsumer) {
101101
this.actual.writeTo(out);
102102
try (TarArchiveInputStream in = new TarArchiveInputStream(
103103
new ByteArrayInputStream(out.toByteArray()))) {
104-
TarArchiveEntry entry = in.getNextTarEntry();
104+
TarArchiveEntry entry = in.getNextEntry();
105105
while (entry != null) {
106106
if (entry.getName().equals(name)) {
107107
ByteArrayOutputStream entryOut = new ByteArrayOutputStream();
108108
IOUtils.copy(in, entryOut);
109109
assertConsumer.accept(new JsonContentAssert(LayerContentAssert.class, entryOut.toString()));
110110
return;
111111
}
112-
entry = in.getNextTarEntry();
112+
entry = in.getNextEntry();
113113
}
114114
}
115115
failWithMessage("Expected JSON entry '%s' in layer with digest '%s'", name, this.actual.getId());

0 commit comments

Comments
 (0)