Build: any reactor build stopping before 'package' fails with "module not found: com.clickhouse.data" in clickhouse-client java11 module-info
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 50/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- java
- Domain
- build-system
Research direction
Start by reproducing the failure with mvn -B -pl clickhouse-client -am -DskipTests test, then inspect the java11 compiler execution in pom.xml and the affected module-info.java files. Check the documented commands in AGENTS.md and CONTRIBUTING.md; done means test-phase reactor builds succeed while verify/install builds and the multi-release jar contents remain unchanged.
Written by the indexing model from the issue text.
Description
Description
Since the JPMS service-loader change (PR #2941, issue #2669) added clickhouse-client/src/main/java11/module-info.java, any Maven reactor build that stops at a lifecycle phase earlier than package fails while compiling that module descriptor:
error: module not found: com.clickhouse.data
This includes the two build commands the repo itself documents for module development:
AGENTS.md:35— "Run a module with dependencies:mvn -pl <module> -am test"CONTRIBUTING.md:133—mvn -pl <module> -am test
and also the plain full-reactor mvn test. A contributor on a clean checkout therefore hits a hard build failure with the documented command.
Builds that reach package or later (package, install, verify) succeed.
Steps to reproduce
- Clean checkout of
main(reproduced at05393dd6, the #2941 merge), JDK 17 + Maven 3.9.15. mvn -B -pl clickhouse-client -am -DskipTests test→ FAILS
(same formvn -B -pl client-v2 -am -DskipTests test, and for full-reactormvn -B -DskipTests test)mvn -B cleanthenmvn -B -pl clickhouse-client -am -DskipTests package→ SUCCEEDS
Error Log or Exception StackTrace
[INFO] --- compiler:3.14.0:compile (java11) @ clickhouse-client ---
[INFO] Toolchain in maven-compiler-plugin: JDK[/opt/java/openjdk]
[INFO] Compiling 1 source file with javac [forked debug release 11 module-path] to target/classes/META-INF/versions/11
[ERROR] COMPILATION ERROR :
/work/clickhouse-client/src/main/java11/module-info.java:[10,38] error: module not found: com.clickhouse.data
[INFO] 1 error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.14.0:compile (java11) on project clickhouse-client: Compilation failure
Reactor summary:
[INFO] clickhouse-java .................................... SUCCESS
[INFO] ClickHouse Data Processing Utilities ............... SUCCESS
[INFO] ClickHouse Java Client ............................. FAILURE
[INFO] ClickHouse Client API .............................. SKIPPED
Expected Behaviour
mvn -pl <module> -am test (and mvn test) build successfully, as documented in AGENTS.md and CONTRIBUTING.md.
Root cause
The java11 execution of maven-compiler-plugin in the parent pom.xml (executions block around lines 558-575, bound to the compile phase by the compile-java11 profile at lines 766-788) compiles with multiReleaseOutput=true, so the descriptor of each module is written to target/classes/META-INF/versions/11/module-info.class and not to target/classes/module-info.class.
When the upstream module is built in the same reactor run but that run never reaches package, Maven puts the directory clickhouse-data/target/classes on the path instead of a jar. javac applies multi-release semantics only to jars, so for a directory root it sees no module-info.class, treats clickhouse-data/target/classes as an unnamed/automatic entry, and requires transitive com.clickhouse.data in clickhouse-client/src/main/java11/module-info.java:10 cannot be resolved.
Confirmations:
find clickhouse-data/target/classes -name module-info.class→clickhouse-data/target/classes/META-INF/versions/11/module-info.classonly.mvn -Dj8 -pl clickhouse-client -am -DskipTests testsucceeds —-Dj8deactivates thecompile-java11profile, so the failing execution never runs.packagesucceeds becauseclickhouse-datais jarred beforeclickhouse-clientcompiles, and the jar carriesMulti-Release: true.
CI does not catch this, because the CI jobs run verify/install-level builds, which are past package.
Six modules have such a descriptor and are affected the same way once they depend on each other: clickhouse-data, clickhouse-client, clickhouse-http-client, clickhouse-jdbc, jdbc-v2, clickhouse-r2dbc.
Suggested fix
Options, in rough order of preference:
- Make the
java11execution resolve upstream module descriptors independently of the reactor phase — e.g. add an explicit--module-path/--patch-modulefor the reactor dependencies, or configure the execution withuseModulePath=falseand pass-Xlint-safe compiler args, so the descriptor compiles against the classpath instead of the module path. (module-info.javacompilation does need the required modules to be resolvable, so simply disabling the module path may need--add-reads/--patch-modulecare.) - Also emit a root
module-info.class(or run thejava11execution atprepare-packagewith a jarred upstream), sotarget/classesis a valid module root during atest-phase reactor build. - If neither is acceptable, update
AGENTS.mdandCONTRIBUTING.mdso the documented commands are the ones that work (mvn -pl <module> -am verify -DskipITs=true, orinstallof the upstream modules first), and note the limitation.
Contrast case that must keep working: mvn install / mvn verify full and subset builds, and the multi-release jar contents (META-INF/versions/11/module-info.class present in the published jars) must not change.
Configuration
Environment
- Cloud
- Client version:
0.10.0-rc1-SNAPSHOT(main@05393dd6) - Language version: OpenJDK 17.0.18 (with JDK 8 toolchain also available), Maven 3.9.15
- OS: Ubuntu 24.04 (container)
ClickHouse Server
- Not relevant — this is a build/packaging failure; no server interaction is reached.
Found by automated analysis of this client while working on an unrelated change, and verified by building pristine main in a clean container (not by inspection only). Regression from #2941 / #2669.
- Dominant language
- Java
- Stars
- 1.6k
- Forks
- 637
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ClickHouse/clickhouse-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ClickHouse/clickhouse-java#3143 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
ClickHouse/clickhouse-java#3111 ·
-
area:data-type bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ClickHouse/clickhouse-java#3098 · 1 comment ·
-
bug client-api-v2 test
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
ClickHouse/clickhouse-java#3076 ·
-
area:sql-parser bug client-v1
Difficulty 1/5 1-3 hours Newbie friendliness 92/100
ClickHouse/clickhouse-java#3066 ·
All issues in ClickHouse/clickhouse-java
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100