Publish thin main jar; move fat jar to shaded classifier#71
Open
stefanhahmann wants to merge 2 commits intozarr-developers:mainfrom
Open
Publish thin main jar; move fat jar to shaded classifier#71stefanhahmann wants to merge 2 commits intozarr-developers:mainfrom
stefanhahmann wants to merge 2 commits intozarr-developers:mainfrom
Conversation
The maven-shade-plugin currently replaces the main artifact with the fat
jar and publishes a dependency-reduced POM. Library consumers therefore
get a jar that bundles Jackson/AWS SDK/okhttp/etc., paired with a POM
that declares no dependencies — which causes duplicate-class failures
under maven-enforcer-plugin's RequireUpperBoundDeps/banDuplicateClasses
when the consumer also depends on those libraries directly.
Switch to shadedArtifactAttached=true with classifier "shaded" and
disable the reduced POM. This publishes:
- zarr-java-<version>.jar thin jar, only zarr-java classes;
full POM with proper transitive
dependencies for library consumers.
- zarr-java-<version>-shaded.jar fat jar with Main-Class manifest,
for CLI users
(java -jar zarr-java-...-shaded.jar).
stefanhahmann
added a commit
to BioImageTools/ome-zarr-fiji-java
that referenced
this pull request
Apr 29, 2026
The 0.1.3-SNAPSHOT version (zarr-developers/zarr-java#71) is not deployed to any Maven repository, so each CI workflow now clones the PR branch and runs `mvn -DskipTests -Dgpg.skip=true install` to populate the local m2 repo before the project build. `gpg.skip` is required because zarr-java's pom unconditionally signs artifacts during the verify phase. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
stefanhahmann
added a commit
to BioImageTools/ome-zarr-fiji-java
that referenced
this pull request
Apr 30, 2026
The 0.1.3-SNAPSHOT version (zarr-developers/zarr-java#71) is not deployed to any Maven repository, so each CI workflow now clones the PR branch and runs `mvn -DskipTests -Dgpg.skip=true install` to populate the local m2 repo before the project build. `gpg.skip` is required because zarr-java's pom unconditionally signs artifacts during the verify phase. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
sbesson
approved these changes
May 1, 2026
Contributor
sbesson
left a comment
There was a problem hiding this comment.
Thanks for identifying this regression and opening a fix @stefanhahmann. Indeed, the size of the JAR published to Maven Central exploded in the 0.1.2 release (which arguably should have been released as 0.2.0).
With this PR included, the uberJAR is generated with the -shaded classifier
sbesson@Sebastien-GS-MacBook-Pro-2025 jar-Linux % ls -alh
total 89176
drwx------@ 5 sbesson staff 160B 1 May 16:52 .
drwx------@ 15 sbesson staff 480B 1 May 16:52 ..
-rw-r--r--@ 1 sbesson staff 1.3M 30 Apr 08:51 zarr-java-0.1.3-SNAPSHOT-javadoc.jar
-rw-r--r--@ 1 sbesson staff 42M 30 Apr 08:51 zarr-java-0.1.3-SNAPSHOT-shaded.jar
-rw-r--r--@ 1 sbesson staff 270K 30 Apr 08:51 zarr-java-0.1.3-SNAPSHOT.jar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The maven-shade-plugin in the
pom.xmlcurrently replaces the main artifact with a fat jar and publishes a dependency-reduced POM. Library consumers therefore receive a jar bundling jackson-*, aws-sdk:s3, okhttp, commons-compress, etc., paired with a POM that declares no runtime dependencies.When a downstream project depends on dev.zarr:zarr-java and also directly on any of those libraries (very common — e.g. Jackson is ubiquitous),
maven-enforcer-plugin'sduplicate-class/upper-bound-depsrules fail the build because the same classes appear both inside the shaded zarr-java jar and on the regular classpath. There is no clean way for the consumer to exclude them, since the POM hides the bundled coordinates.Change
Switch the shade execution to attach the fat jar under a classifier rather than replacing the main artifact, and disable the dependency-reduced POM:
Released artifacts after this change:
CLI users who want the executable jar from Maven Central can pull it with shaded.
Verified locally
Notes / non-goals