testcontainers / testcontainers/testcontainers-java

[Enhancement]: Shrink size of core-jar / Rethink shading

Offen
#8,612 0 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

type/enhancement
Vorherrschende Sprache
Java
Sterne
8.7k
Forks
1.9k
Ø Merge
2 T. 17 Std.
Gemergte PRs (30 T.)
9

Beschreibung

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.bouncycastle or org.awaitability.
    There are also other libraries that could be easily replaced, e.g. guava as 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne im Core-Modul und untersuche, wie geshadete Artefakte deklariert und in das testcontainers-JAR gepackt werden. Prüfe, welche der aufgeführten Abhängigkeiten erforderlich sind, ermittle die Größen des gepackten und entpackten JARs und vergleiche die Ansätze mit Shading und BOM. Als abgeschlossen gilt eine festgelegte Abhängigkeitsstrategie, die das Core-JAR verkleinert, ohne seine Consumer zu beeinträchtigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
build-system
Issue-Typ
Refactoring
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.