From 1bfd566876442f30513a1f3affc595ac9b93b388 Mon Sep 17 00:00:00 2001 From: Polyglot AI <293096396+polyglotAI-bot@users.noreply.github.com> Date: Tue, 24 Nov 2026 01:04:52 +0000 Subject: [PATCH 1/2] [repo] Do not declare the bundled dependencies in the clickhouse-jdbc-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: https://github.com/ClickHouse/clickhouse-java/issues/2474 Co-Authored-By: Claude Opus 5.5 --- docs/clickhouse-docs/jdbc.mdx | 14 ++++++++++++++ docs/integration-jdbc.md | 22 ++++++++++++++++++++++ history/latest/2474.md | 6 ++++++ packages/clickhouse-jdbc-all/pom.xml | 6 ++++++ 4 files changed, 48 insertions(+) create mode 100644 history/latest/2474.md diff --git a/docs/clickhouse-docs/jdbc.mdx b/docs/clickhouse-docs/jdbc.mdx index f8e044bf4..785fc45d2 100644 --- a/docs/clickhouse-docs/jdbc.mdx +++ b/docs/clickhouse-docs/jdbc.mdx @@ -34,9 +34,23 @@ We recommend using the latest java client directly if performance/direct access clickhouse-jdbc 0.10.0 all + + + * + * + + + +{/* https://mvnrepository.com/artifact/org.slf4j/slf4j-api */} + + org.slf4j + slf4j-api + 2.0.16 ``` +The `all` classifier uses the POM of the standard artifact. Without the exclusion, Maven also adds the dependencies of the standard artifact, and some classes are then on the classpath two times, with different content. The shaded jar does not contain SLF4J, thus add `slf4j-api`. + If you are using JDBC driver within an application that requires jar to be added to the classpath, you need to add download the jar from: - [Maven Central](https://mvnrepository.com/artifact/com.clickhouse/clickhouse-jdbc) and add it to the classpath - starting from version `0.9.4` there is an artifact https://mvnrepository.com/artifact/com.clickhouse/clickhouse-jdbc-all diff --git a/docs/integration-jdbc.md b/docs/integration-jdbc.md index 868df2141..00c42cf70 100644 --- a/docs/integration-jdbc.md +++ b/docs/integration-jdbc.md @@ -33,6 +33,28 @@ Two distributions are published under the same artifact: - **Standard artifact** (default, no classifier) — the driver together with its dependencies declared as ordinary transitive Maven dependencies. Recommended for managed builds in which the application controls the dependency tree. - **Shaded artifact** (`all` classifier) — a single self-contained archive that bundles and **relocates** most third-party dependencies. Recommended when transitive dependencies cannot be managed. +The `all` classifier uses the POM of the standard artifact. Thus Maven also adds the dependencies of the standard artifact (`jdbc-v2`, `client-v2`, `clickhouse-data`, and others), and some classes are then on the classpath two times, with different content. To use only the shaded archive, exclude all transitive dependencies and add `slf4j-api`, because the shaded archive does not contain SLF4J: + +```xml + + com.clickhouse + clickhouse-jdbc + ${clickhouse-java.version} + all + + + * + * + + + + + org.slf4j + slf4j-api + ${slf4j.version} + +``` + --- ## Integration path at a glance diff --git a/history/latest/2474.md b/history/latest/2474.md new file mode 100644 index 000000000..920cfb6cd --- /dev/null +++ b/history/latest/2474.md @@ -0,0 +1,6 @@ +- **[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. The JDBC docs + now show how to use the `all` classifier of `clickhouse-jdbc` without the dependencies of the standard artifact. + (https://github.com/ClickHouse/clickhouse-java/issues/2474) diff --git a/packages/clickhouse-jdbc-all/pom.xml b/packages/clickhouse-jdbc-all/pom.xml index e610e4829..d02ea4026 100644 --- a/packages/clickhouse-jdbc-all/pom.xml +++ b/packages/clickhouse-jdbc-all/pom.xml @@ -96,6 +96,12 @@ org.codehaus.mojo flatten-maven-plugin + + + + remove + + flatten From 9cebb8187c273391a7bba7e4a92449859b64c14b Mon Sep 17 00:00:00 2001 From: Polyglot AI <293096396+polyglotAI-bot@users.noreply.github.com> Date: Tue, 24 Nov 2026 03:41:04 +0000 Subject: [PATCH 2/2] [repo] Revert the JDBC docs changes of the clickhouse-jdbc-all POM fix 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 --- docs/clickhouse-docs/jdbc.mdx | 14 -------------- docs/integration-jdbc.md | 22 ---------------------- history/latest/2474.md | 3 +-- 3 files changed, 1 insertion(+), 38 deletions(-) diff --git a/docs/clickhouse-docs/jdbc.mdx b/docs/clickhouse-docs/jdbc.mdx index 785fc45d2..f8e044bf4 100644 --- a/docs/clickhouse-docs/jdbc.mdx +++ b/docs/clickhouse-docs/jdbc.mdx @@ -34,23 +34,9 @@ We recommend using the latest java client directly if performance/direct access clickhouse-jdbc 0.10.0 all - - - * - * - - - -{/* https://mvnrepository.com/artifact/org.slf4j/slf4j-api */} - - org.slf4j - slf4j-api - 2.0.16 ``` -The `all` classifier uses the POM of the standard artifact. Without the exclusion, Maven also adds the dependencies of the standard artifact, and some classes are then on the classpath two times, with different content. The shaded jar does not contain SLF4J, thus add `slf4j-api`. - If you are using JDBC driver within an application that requires jar to be added to the classpath, you need to add download the jar from: - [Maven Central](https://mvnrepository.com/artifact/com.clickhouse/clickhouse-jdbc) and add it to the classpath - starting from version `0.9.4` there is an artifact https://mvnrepository.com/artifact/com.clickhouse/clickhouse-jdbc-all diff --git a/docs/integration-jdbc.md b/docs/integration-jdbc.md index 00c42cf70..868df2141 100644 --- a/docs/integration-jdbc.md +++ b/docs/integration-jdbc.md @@ -33,28 +33,6 @@ Two distributions are published under the same artifact: - **Standard artifact** (default, no classifier) — the driver together with its dependencies declared as ordinary transitive Maven dependencies. Recommended for managed builds in which the application controls the dependency tree. - **Shaded artifact** (`all` classifier) — a single self-contained archive that bundles and **relocates** most third-party dependencies. Recommended when transitive dependencies cannot be managed. -The `all` classifier uses the POM of the standard artifact. Thus Maven also adds the dependencies of the standard artifact (`jdbc-v2`, `client-v2`, `clickhouse-data`, and others), and some classes are then on the classpath two times, with different content. To use only the shaded archive, exclude all transitive dependencies and add `slf4j-api`, because the shaded archive does not contain SLF4J: - -```xml - - com.clickhouse - clickhouse-jdbc - ${clickhouse-java.version} - all - - - * - * - - - - - org.slf4j - slf4j-api - ${slf4j.version} - -``` - --- ## Integration path at a glance diff --git a/history/latest/2474.md b/history/latest/2474.md index 920cfb6cd..b1a9ef4ae 100644 --- a/history/latest/2474.md +++ b/history/latest/2474.md @@ -1,6 +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. The JDBC docs - now show how to use the `all` classifier of `clickhouse-jdbc` without the dependencies of the standard artifact. + 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)