testcontainers / testcontainers/testcontainers-java
[Enhancement]: Shrink size of core-jar / Rethink shading
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
Module
Core
Proposal
The testcontainers jar file currently has a size of a whopping 17MB (packed; unpacked 34MB), making it by far one of the biggest maven dependencies I know of.
Most of the size (>97%; 33MB) seems to come from shaded artifacts inside org.testcontainers.shaded.
A full list of disadvantages of shading can be found in JLBP-18.
I think the jar could be a lot smaller. Here a few ways how this could be tackled:
- Check if all the shaded dependencies are required in the core module in the first place. I check the core module and couldn't find any class that implements:
org.hamcrest,org.checkerframework,org.bouncycastleororg.awaitability.
There are also other libraries that could be easily replaced, e.g.guavaas it's only used in a few places and uses nowadays standard java stuff. Removing these 5 libs alone would shrink the lib by 23MB or 67% alone. - Maybe don't use shading at all and publish a bom that contains the exact versions of the required dependencies, that way there should also be no dependency conflicts
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the Core module and inspect how shaded artifacts are declared and packaged into the testcontainers jar. Review which listed dependencies are required, measure the packed and unpacked jar sizes, and compare the shading and BOM approaches. Done means a decided dependency strategy that reduces the core jar without breaking its consumers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100