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
5 changes: 5 additions & 0 deletions history/latest/2474.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- **[repo]** Fixed duplicate classes on the classpath of an application that uses `com.clickhouse:clickhouse-jdbc-all`.
The jar of this artifact contains all its dependencies, but its POM also declared them, so Maven added
`clickhouse-jdbc` (classifier `all`), `jdbc-v2`, `client-v2`, `clickhouse-data` and the third-party jars next to it.
The POM now declares no dependencies, so tools that read the POM no longer list the bundled libraries.
(https://github.com/ClickHouse/clickhouse-java/issues/2474)
6 changes: 6 additions & 0 deletions packages/clickhouse-jdbc-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<configuration>
<!-- The shaded jar contains all dependencies. Do not declare them again in the published POM. -->
<pomElements>
<dependencies>remove</dependencies>
</pomElements>
</configuration>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1bfd566. Configure here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

<executions>
<execution>
<id>flatten</id>
Expand Down
Loading