testcontainers-java icon indicating copy to clipboard operation
testcontainers-java copied to clipboard

Testcontainers is including shaded classes of Bouncycastle

Open d53dave opened this issue 4 years ago • 2 comments

Hi,

I've read that with version 1.11 (https://github.com/testcontainers/testcontainers-java/pull/1307) the shaded dependencies were removed. I'm using v 1.15.3 now and I still see shaded classes in org.testcontainers.shaded.org.bouncycastle. While this hasn't caused direct issues for me (yet), autocomplete still suggests those classes before the ones that I directly include as dependencies in my project.

I know this is a debatable subject, but if the initial reason for shading (netty) went away in May 2019, then these classes really should not be in here anymore.

d53dave avatar Jun 21 '21 09:06 d53dave

I came across this because I've found at least 3 shaded instances of a Base64 encoding/decoding algorithm on the classpath when testcontainers is present:

image

Since JDK 8, there is now java.util.Base64, so I was going to suggest replacing the others. But I can't even find any reference to org.bouncycastle. Is this dependency still needed, even?

lukaseder avatar Mar 31 '22 12:03 lukaseder

For reference, bouncycastle comes as a transitive dependency of com.github.docker-java:docker-java-core:

% ./gradlew :testcontainers:dependencies --configuration shaded

shaded
+--- org.awaitility:awaitility:4.2.0
|    \--- org.hamcrest:hamcrest:2.1
+--- com.github.docker-java:docker-java-bom:3.4.2
|    +--- com.github.docker-java:docker-java-core:3.4.2 (c)
|    +--- com.github.docker-java:docker-java-api:3.4.2 (c)
|    \--- com.github.docker-java:docker-java-transport:3.4.2 (c)
+--- com.github.docker-java:docker-java-core -> 3.4.2
|    +--- com.github.docker-java:docker-java-api:3.4.2
|    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.10.3
|    |    \--- org.slf4j:slf4j-api:1.7.30
|    +--- com.github.docker-java:docker-java-transport:3.4.2
|    +--- org.slf4j:slf4j-api:1.7.30
|    +--- commons-io:commons-io:2.13.0
|    +--- org.apache.commons:commons-compress:1.21
|    +--- org.apache.commons:commons-lang3:3.12.0
|    +--- com.fasterxml.jackson.core:jackson-databind:2.10.3 -> 2.8.8
|    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.8.0 -> 2.10.3
|    |    \--- com.fasterxml.jackson.core:jackson-core:2.8.8
|    \--- org.bouncycastle:bcpkix-jdk18on:1.76
|         +--- org.bouncycastle:bcprov-jdk18on:1.76
|         \--- org.bouncycastle:bcutil-jdk18on:1.76
|              \--- org.bouncycastle:bcprov-jdk18on:1.76
+--- com.google.guava:guava:33.3.1-jre
|    +--- com.google.guava:failureaccess:1.0.2
|    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|    +--- com.google.code.findbugs:jsr305:3.0.2
|    +--- org.checkerframework:checker-qual:3.43.0
|    +--- com.google.errorprone:error_prone_annotations:2.28.0
|    \--- com.google.j2objc:j2objc-annotations:3.0.0
+--- org.yaml:snakeyaml:1.33
+--- org.glassfish.main.external:trilead-ssh2-repackaged:4.1.2
\--- org.zeroturnaround:zt-exec:1.12
     \--- org.slf4j:slf4j-api:1.7.2 -> 1.7.30

vlsi avatar Jun 06 '25 07:06 vlsi