Build: any reactor build stopping before 'package' fails with "module not found: com.clickhouse.data" in clickhouse-client java11 module-info
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 50/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- java
- Ambito
- build-system
Direzione di ricerca
Inizia riproducendo il fallimento con mvn -B -pl clickhouse-client -am -DskipTests test, quindi esamina l’esecuzione del compilatore java11 in pom.xml e i file module-info.java interessati. Controlla i comandi documentati in AGENTS.md e CONTRIBUTING.md; il lavoro è completato quando le build del reactor nella fase di test hanno esito positivo, mentre le build verify/install e i contenuti del multi-release jar rimangono invariati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Java
- Stelle
- 1.6k
- Fork
- 637
- Merge medio
- 2g 12h
- PR unite (30g)
- 28
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ClickHouse/clickhouse-java
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ClickHouse/clickhouse-java#3143 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
ClickHouse/clickhouse-java#3111 ·
-
area:data-type bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ClickHouse/clickhouse-java#3098 · 1 commento ·
-
bug client-api-v2 test
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
ClickHouse/clickhouse-java#3076 ·
-
area:sql-parser bug client-v1
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
ClickHouse/clickhouse-java#3066 ·
Tutte le issue di ClickHouse/clickhouse-java
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
infinispan/infinispan#18150 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100