From 52e71227ccf45d8b1ba77b9537ca045c7cd71c61 Mon Sep 17 00:00:00 2001 From: scottf Date: Thu, 10 Sep 2026 07:41:20 -0400 Subject: [PATCH] Keep examples out of the published jar in three projects batch-publish, counters and schedule-message were shipping their example classes inside the main published artifact. Examples are meant to compile, so that they stay correct, but not to be carried into a jar somebody puts in production, where they are only bloat. Each project has two separate things: tasks.register('bundle', Bundle) { from sourceSets.main.output exclude("io/synadia/examples/**") } jar { bundle { bnd(...) } exclude("io/synadia/examples/**") } The registered 'bundle' task is an extra task. The published artifact comes from the jar task by way of components.java, so only the exclude inside jar{} affects what ships. These three had it in the registered task but not in jar{}. The other six that publish a bundle already had both. Measured before, in the main published jar: batch-publish 9 example classes, counters 1, schedule-message 21. After: 0 in all three, and 0 in the six that were already correct. The examples classifier jar still carries them, 4, 1 and 21 respectively, which is the artifact meant to. No source, no dependency and no publishing coordinate changes. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01YRbGPiFEXpwnU9BEy8mXb7 --- batch-publish/build.gradle | 1 + counters/build.gradle | 1 + schedule-message/build.gradle | 1 + 3 files changed, 3 insertions(+) diff --git a/batch-publish/build.gradle b/batch-publish/build.gradle index 1967e94..c9e3284 100644 --- a/batch-publish/build.gradle +++ b/batch-publish/build.gradle @@ -75,6 +75,7 @@ jar { "Target-Compatibility": "Java " + JavaVersion.VERSION_1_8 ) } + exclude("io/synadia/examples/**") } test { diff --git a/counters/build.gradle b/counters/build.gradle index ca124e8..0404d51 100644 --- a/counters/build.gradle +++ b/counters/build.gradle @@ -80,6 +80,7 @@ jar { "Target-Compatibility": "Java " + JavaVersion.VERSION_1_8 ) } + exclude("io/synadia/examples/**") } test { diff --git a/schedule-message/build.gradle b/schedule-message/build.gradle index 3a892ae..886c750 100644 --- a/schedule-message/build.gradle +++ b/schedule-message/build.gradle @@ -74,6 +74,7 @@ jar { "Target-Compatibility": "Java " + JavaVersion.VERSION_1_8 ) } + exclude("io/synadia/examples/**") } test {