Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions AdvancedCore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<!-- This shaded JAR is not multi-release or a JPMS module. -->
<exclude>META-INF/versions/**</exclude>
<exclude>module-info.class</exclude>
<!-- Optional compile-time annotations need not be embedded.
Do not strip runtime services or dependency implementations. -->
<exclude>org/checkerframework/**</exclude>
<exclude>org/jspecify/**</exclude>
<!-- Maven descriptors are not runtime version or service data. -->
<exclude>META-INF/maven/**/pom.xml</exclude>
<exclude>META-INF/maven/**/pom.properties</exclude>
</excludes>
</filter>
</filters>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,29 @@ void keepsRequiredClassesAndRelocations() throws Exception {
assertNotNull(artifact.getEntry("com/bencodez/simpleapi/folialib/FoliaLib.class"));
assertNotNull(artifact.getEntry("com/bencodez/simpleapi/hikari/HikariDataSource.class"));
assertNotNull(artifact.getEntry("com/bencodez/advancedcore/rhino/Context.class"));
// The normal published AdvancedCore JAR must retain the transport APIs
// embedded in SimpleAPI; downstream consumers load these in isolation.
assertNotNull(artifact.getEntry("redis/clients/jedis/HostAndPort.class"));
assertNotNull(artifact.getEntry("org/eclipse/paho/client/mqttv3/MqttClient.class"));
assertNotNull(artifact.getEntry("com/bencodez/simpleapi/servercomm/http/HttpTlsIdentity.class"));

assertNull(artifact.getEntry("com/tcoded/folialib/FoliaLib.class"));
assertNull(artifact.getEntry("com/zaxxer/hikari/HikariDataSource.class"));
assertNull(artifact.getEntry("org/mozilla/javascript/Context.class"));
assertTrue(artifact.getManifest() != null);
assertTrue(!"true".equalsIgnoreCase(
artifact.getManifest().getMainAttributes().getValue("Multi-Release")),
"Versioned implementations cannot be filtered from a multi-release JAR");
assertTrue(artifact.stream().noneMatch(entry -> entry.getName().startsWith("META-INF/versions/")
|| entry.getName().equals("module-info.class")),
"The shaded distribution must not contain unreachable module payload");
assertTrue(artifact.stream().noneMatch(entry -> entry.getName().startsWith("org/checkerframework/")
|| entry.getName().startsWith("org/jspecify/")),
"Optional annotation libraries should not be embedded");
assertTrue(artifact.stream().noneMatch(entry -> entry.getName().startsWith("META-INF/maven/")
&& (entry.getName().endsWith("/pom.xml")
|| entry.getName().endsWith("/pom.properties"))),
"Dependency Maven descriptors should not be embedded");
}
System.out.printf("AdvancedCore packaged artifact: %,d bytes; required classes and relocations retained%n",
Files.size(artifactPath));
Expand Down
24 changes: 24 additions & 0 deletions docs/jar-packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,27 @@ applies its own narrow artifact filters when producing its smaller user-facing
distribution.
Deployment profiles use the same Shade configuration; only
publication/final-name behavior differs.

## Additional safe-to-test size filtering

The normal AdvancedCore artifact embeds SimpleAPI's full published
implementation and must retain its legacy Redis classes, HTTP TLS classes,
and MQTT classes for downstream consumers, even though AdvancedCore itself does
not call those transports. Do not strip them solely on local source reachability.

The shaded JAR is not a multi-release JAR or JPMS module, so the Maven Shade
filters omit `META-INF/versions/**` and root `module-info.class`. Redundant
dependency `META-INF/maven/**/pom.xml` and `pom.properties` descriptions
are also omitted; service files, version fallbacks, licenses, native resources,
and deployed plugin metadata remain.

Checker Framework and JSpecify annotation implementation packages are filtered
from the shaded JAR, rather than changing the Java dependency graph or published
method signatures. If an external consumer compiles directly against those
annotation types, it must declare the separate annotation dependency; that
source-compatibility edge remains a review consideration.

Use `mvn -B -f AdvancedCore/pom.xml clean package` and check both
`PackagedArtifactTest` and VotingPlugin's packaged producer-compatibility test
before accepting an artifact change. The suite exercises class loading but does
not substitute for live Bukkit/Paper/Folia startup validation.
Loading