2323public class FullArtifactTest {
2424 @ TempDir Path temporary ;
2525
26- @ Test void retainsBaseCryptoClassesWithoutUnusedVersionedPayload () throws Exception {
26+ @ Test void retainsBaseCryptoClassesWithoutUnusableVersionedPayload () throws Exception {
2727 Path full = fullJar ();
2828 long removedEntries = 0 ;
2929 long removedCompressedBytes = 0 ;
@@ -35,8 +35,8 @@ public class FullArtifactTest {
3535 "Revisit the BC filter before making the full artifact multi-release" );
3636 String classPath = output .getManifest ().getMainAttributes ().getValue (Attributes .Name .CLASS_PATH );
3737 assertTrue (classPath == null || classPath .isBlank (), "Smoke test must not load external manifest dependencies" );
38- assertFalse (output .stream ().anyMatch (entry -> entry .getName ().startsWith ("META-INF/versions/" )
39- && entry . getName (). contains ( "/org/bouncycastle/" )), "Unused versioned BC payload is still bundled " );
38+ assertFalse (output .stream ().anyMatch (entry -> entry .getName ().startsWith ("META-INF/versions/" )),
39+ "A non-multi-release artifact must not bundle unreachable versioned implementations " );
4040
4141 // Resolve all three original libraries from Maven, without a pinned version or ~/.m2 path.
4242 for (Class <?> anchor : List .of (BouncyCastleProvider .class , X509CertificateHolder .class , ContentInfo .class )) {
@@ -62,6 +62,21 @@ public class FullArtifactTest {
6262 Files .size (full ), retainedEntries , removedEntries , removedCompressedBytes );
6363 }
6464
65+ @ Test void thinArtifactContainsProjectClassesWithoutEmbeddedDependencies () throws Exception {
66+ Path thin = thinJar ();
67+ try (JarFile artifact = new JarFile (thin .toFile ())) {
68+ assertNotNull (artifact .getEntry ("com/bencodez/simpleapi/servercomm/http/HttpTlsIdentity.class" ),
69+ "Thin artifact must preserve the complete SimpleAPI API" );
70+ assertNotNull (artifact .getEntry ("com/bencodez/simpleapi/scheduler/BukkitScheduler.class" ));
71+ assertNull (artifact .getEntry ("org/bouncycastle/jce/provider/BouncyCastleProvider.class" ));
72+ assertNull (artifact .getEntry ("com/zaxxer/hikari/HikariDataSource.class" ));
73+ assertNull (artifact .getEntry ("redis/clients/jedis/Jedis.class" ));
74+ assertNull (artifact .getEntry ("org/spongepowered/configurate/ConfigurationNode.class" ));
75+ assertFalse (artifact .stream ().anyMatch (entry -> entry .getName ().startsWith ("META-INF/versions/" )));
76+ }
77+ System .out .printf ("Thin artifact: %,d bytes (project classes only)%n" , Files .size (thin ));
78+ }
79+
6580 @ Test void packagedTlsWorksWithoutMavenDependencies () throws Exception {
6681 Path full = fullJar ();
6782 String fixtureName = PackagedTlsSmoke .class .getName ();
@@ -104,4 +119,12 @@ private static Path fullJar() {
104119 assertTrue (Files .isRegularFile (full ), "Missing packaged full artifact: " + full );
105120 return full ;
106121 }
122+
123+ private static Path thinJar () {
124+ String value = System .getProperty ("simpleapi.thinJar" );
125+ assertNotNull (value , "Run this test through the Maven package lifecycle" );
126+ Path thin = Path .of (value ).toAbsolutePath ().normalize ();
127+ assertTrue (Files .isRegularFile (thin ), "Missing packaged thin artifact: " + thin );
128+ return thin ;
129+ }
107130}
0 commit comments