Slim the shaded jar from 7.3 MB down to 2.0 MB

Three things bloated it. Nothing tree-shook the dependencies, so all of
bcprov shipped even though only its lightweight API (AES-EAX, ECDSA over
prime256v1, ASN.1, EC point math) is ever touched. Its multi-release
copies under META-INF/versions accounted for another 2.3 MB that could
never even load, since the shaded jar is not itself multi-release.
And ts3j dragged in commons-lang and dnsjava for one call each.

Enable minimizeJar, keeping our own modules and ts3j whole (they are the
entry points, and ts3j instantiates packet bodies reflectively), and drop
the versioned entries. The shade plugin has to move to 3.6.2 for this:
3.5.1 bundles an ASM that cannot read class file major version 70.

The remaining large entry is the bundled Windows Opus DLL, at 612 KB.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-13 23:47:03 +00:00
parent 9d63522ef2
commit d5018729d8
2 changed files with 26 additions and 2 deletions

View File

@@ -39,7 +39,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<version>3.6.2</version>
<executions>
<execution>
<phase>package</phase>
@@ -47,10 +47,34 @@
<goal>shade</goal>
</goals>
<configuration>
<!--
Tree-shake the dependencies: only a fraction of Bouncy Castle
(the lightweight EC/AES-EAX API) is actually reachable.
-->
<minimizeJar>true</minimizeJar>
<filters>
<!-- Our own modules are entry points; keep them whole. -->
<filter>
<artifact>com.ts3client:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>com.github.manevolent:ts3j</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
<!--
The shaded jar is not a multi-release jar, so the
versioned copies (all Bouncy Castle's) are never loaded,
and minimizeJar does not tree-shake them either.
-->
<exclude>META-INF/versions/**</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>

2
ts3j

Submodule ts3j updated: db57d60c98...dce4e68150