Repository navigation
[repo] Do not declare the bundled dependencies in the clickhouse-jdbc-all POM - #3413
polyglotAI-bot wants to merge 2 commits into
Conversation
…-all POM The clickhouse-jdbc-all jar contains all its dependencies, but the flatten plugin (flattenDependencyMode=all, run at package after shade) wrote the full dependency tree into the published POM. Maven then added clickhouse-jdbc:all, jdbc-v2, client-v2, clickhouse-data and the third-party jars next to the shaded jar, with duplicate and different classes. Remove the dependencies element from the flattened POM. The all classifier of clickhouse-jdbc shares the POM of the standard artifact, so document the exclusion and slf4j-api for it. Fixes: #2474 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1bfd566. Configure here.
| <pomElements> | ||
| <dependencies>remove</dependencies> | ||
| </pomElements> | ||
| </configuration> |
There was a problem hiding this comment.
Flatten override strips published POM metadata
High Severity
The new pomElements block sets only dependencies to remove. Parent flatten-maven-plugin 1.2.7 is configured with flattenMode=ossrh so the published POM keeps Central-required fields. In 1.2.7, a non-null pomElements replaces that mode instead of merging with it, so unspecified elements use the default flatten handling and name, description, url, licenses, developers, and scm are omitted. Staging to Maven Central can then reject clickhouse-jdbc-all.
Reviewed by Cursor Bugbot for commit 1bfd566. Configure here.
There was a problem hiding this comment.
Checked. This does not occur with flatten-maven-plugin 1.2.7. In FlattenMojo.getFlattenDescriptor(), the plugin replaces the mode with pomElements only when flattenMode is null. When both are set, it merges them: descriptor = pomElements.merge(flattenMode.getDescriptor()) (javap -c of the 1.2.7 jar, bytecode offsets 129–147).
Build of this branch (mvn -pl packages/clickhouse-jdbc-all -am install): the installed clickhouse-jdbc-all-0.12.0-rc1-SNAPSHOT.pom has name, description, url, licenses, developers and scm. Its top-level elements are the same as in the jdbc-v2 POM (no pomElements), with one difference: no dependencies. The release profile does not change the flatten configuration.
No change made.
AI review gate — Cursor Bugbot found issues
Unresolved findings (1): What to do:
Re-run the gate with “Re-run jobs” after an approval or a finished review. A push re-runs it automatically. |
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
chernser
left a comment
There was a problem hiding this comment.
revert changes to integration-jdbc.md and jdbc.mdx - will do them later when settle packaging
The maintainer asked to update the docs later, when the packaging is settled. Remove the docs sentence from the changelog entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


Summary
clickhouse-jdbc-allis a shaded jar that contains all its dependencies. Its published POM also declared them (25 in 0.11.2:clickhouse-jdbc:all,jdbc-v2,client-v2,clickhouse-dataand the third-party jars). Maven added them next to the shaded jar, so the classpath had duplicate and different classes, for examplecom.clickhouse.data.stream.Lz4InputStream.Cause: the shade plugin writes a dependency-reduced POM without dependencies. Then the module runs
flatten-maven-pluginatpackage, and the parent settingflattenDependencyMode=allwrites the full dependency tree into the published POM.Fix: the flatten configuration of
packages/clickhouse-jdbc-allremoves thedependencieselement. The jar does not change (the same 12914 entries). It contains every class, resource and service provider of the 25 former jars, so the classes on the classpath of a user do not change. Tools that read the POM (for example dependency scanners) no longer list the bundled libraries.The
allclassifier ofclickhouse-jdbcuses the POM of the standard artifact, which must keep its dependencies. Workaround: the exclusion*:*andslf4j-api. The docs for it come later, when the packaging is settled.Closes #2474
Test: a Maven project with one dependency,
duplicate-finder-maven-plugin:2.0.1:check, a JDBCSELECTon server 26.10.mainclickhouse-jdbc-allSELECTworksclickhouse-jdbc, classifierall, exclusion*:*,slf4j-apiSELECTworksThere is no automated test: the defect is in the published POM, and the repo has no test of published POMs.
Not changed, for a maintainer decision:
clickhouse-jdbc-alljar also contains not-relocated copies of guava, httpclient5, commons-*, lz4, RoaringBitmap, antlr, asm and slf4j-api. Withslf4j-simple:2.0.13, this PR gives duplicateorg.slf4jclasses (2.0.7 in the jar, 2.0.13 inslf4j-api). Onmain, Maven tookslf4j-api2.0.7 from the POM, so these copies were equal.client-v2with classifierallhas the same POM sharing.docs/integration-client.mdsays that its relocated dependencies cannot collide.Checklist
🤖 Generated with Claude Code
Note
Low Risk
Build/publish-only POM change; runtime jar contents are unchanged, with lower risk of classpath duplicates for Maven consumers.
Overview
Fixes duplicate classes on the classpath when consuming
com.clickhouse:clickhouse-jdbc-all. The shaded artifact already bundles its libraries, but the published POM still listed those dependencies, so Maven pulled in ~25 extra JARs alongside the uber-jar (issue #2474).The
clickhouse-jdbc-allmodule now configuresflatten-maven-pluginwith<dependencies>remove</dependencies>so the flattened POM ships with no dependency declarations. The shaded JAR is unchanged; only Maven metadata and tooling that read the POM (e.g. dependency scanners) see a single self-contained artifact.A CHANGELOG entry documents the fix under
history/latest/2474.md.Reviewed by Cursor Bugbot for commit 9cebb81. Bugbot is set up for automated code reviews on this repo. Configure here.