Skip to content

Commit 2d592da

Browse files
committed
docs: document the Maven reactor layout (llama/ module) in CLAUDE.md
- New "Repository layout — Maven reactor" section: the root is an aggregator/parent POM with llama/ (core) and llama-langchain4j/ modules; core sources + build files now live under llama/; build.sh/build.bat cd into llama/ themselves; core Maven builds use -f llama/pom.xml or -pl llama -am; version bumps happen in the root pom only (both modules inherit). Adds the caveat that existing root-relative build examples in this file now run in llama/. - Rewrote the LangChain4j section: it is now a reactor module inheriting the parent version (no lockstep guard), releasing via one reactor deploy (inherited release profile), with the install step using -pl llama -am. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rt1paYztGJ2AKUuBuAGDXE
1 parent a2857c5 commit 2d592da

1 file changed

Lines changed: 52 additions & 27 deletions

File tree

CLAUDE.md

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,51 +1225,76 @@ keeping it clear of the JPMS module-mode javadoc trap that bit BAF. **Before rai
12251225
javadoc source level to ≥ 9, read**
12261226
[`../workspace/policies/jpms-module-descriptor.md`](../workspace/policies/jpms-module-descriptor.md).
12271227
1228-
## LangChain4j integration (`llama-langchain4j` sibling module)
1228+
## Repository layout — Maven reactor (`llama/` + `llama-langchain4j/`)
1229+
1230+
The repo root is a thin **aggregator/parent POM** (`net.ladenthin:llama-parent`,
1231+
`packaging=pom`) with two modules:
1232+
1233+
- **`llama/`** — the native JNI core (`net.ladenthin:llama`). *All the core sources and build
1234+
files live here now:* `llama/src/`, `llama/CMakeLists.txt`, `llama/cmake/`, `llama/patches/`,
1235+
`llama/pom.xml`, `llama/spotbugs-exclude.xml`, `llama/lombok.config`, `llama/.clang-format`.
1236+
Its published coordinates are unchanged (`net.ladenthin:llama`), so consumers are unaffected.
1237+
- **`llama-langchain4j/`** — the LangChain4j adapters (see below).
1238+
1239+
Both modules inherit the single `<version>` from the parent, so they **ship in lockstep by
1240+
construction** (no CI guard needed). The parent also holds the shared `release` profile (GPG +
1241+
Central Publishing), so one reactor `mvn -P release deploy` signs and publishes all three
1242+
artifacts (`llama-parent` pom, `llama`, `llama-langchain4j`) at the same version.
1243+
1244+
**Consequences for build commands:** the core's cmake/native build runs *in `llama/`*.
1245+
`.github/build.sh` / `build.bat` `cd` into `llama/` themselves (relative to the script), so CI
1246+
and the dockcross containers (whose workdir stays the repo root) are unaffected. Locally, run
1247+
core cmake builds from `llama/` (e.g. `cd llama && cmake -B build && cmake --build build`), and
1248+
target the core with Maven via `-f llama/pom.xml` (or `-pl llama -am` from the root). A plain
1249+
`mvn` at the root builds the whole reactor. **When a build-command example elsewhere in this
1250+
file shows `cmake -B build` / `src/main/...` / `mvn compile` at the root, read it as running in
1251+
`llama/`** (the paths moved; the recipes are otherwise unchanged).
1252+
1253+
**Version bump:** change the `<version>` in the **root** `pom.xml` only; `llama` and
1254+
`llama-langchain4j` inherit it. (The SNAPSHOT/`-SNAPSHOT` line and the README badge still need
1255+
the usual manual update.)
1256+
1257+
## LangChain4j integration (`llama-langchain4j` reactor module)
12291258
12301259
`llama-langchain4j/` adapts a `LlamaModel` to LangChain4j's `ChatModel`,
12311260
`StreamingChatModel`, `EmbeddingModel` and `ScoringModel` interfaces **in-process over
1232-
JNI** (no HTTP hop). It is a **standalone sibling module**, deliberately *not* in the root
1233-
reactor, so the native build/release pipeline is untouched.
1261+
JNI** (no HTTP hop). It is a **reactor module** alongside the core `llama` module (see
1262+
"Repository layout" above), so it is built, versioned and released together with the core.
12341263
12351264
Why it is a **separate artifact** and not a classifier of the core: langchain4j 1.x
12361265
requires **Java 17** (the core stays Java 8), and classifiers share the core's single POM —
12371266
adding `langchain4j-core` there would force it (and the Java 17 floor) on every plain
1238-
`net.ladenthin:llama` consumer. A separate `artifactId` with its own POM is the only way to
1267+
`net.ladenthin:llama` consumer. A separate `artifactId` (its own module POM) is the only way to
12391268
keep that dependency (and Java floor) off the core. It is pure Java with **no per-classifier
12401269
matrix**: it compiles against the core's Java API, which is identical across every native
12411270
classifier; the backend (CPU/CUDA/OpenCL/Vulkan) is a runtime classpath choice for the
12421271
consumer.
12431272
12441273
Wiring:
12451274
1246-
1. **`llama-langchain4j/pom.xml`** — `net.ladenthin:llama-langchain4j`, `release 17`,
1247-
depends on `net.ladenthin:llama:${project.version}` (so the core dep always matches the
1248-
module's own version) and `dev.langchain4j:langchain4j-core`. Carries its own
1249-
sources/javadoc/gpg + `release` profile (Central requires per-artifact signing; the module
1250-
has no parent to inherit them from — plugin versions are pinned in lockstep with the root
1251-
`pom.xml`). Java package stays `net.ladenthin.llama.langchain4j` (package name need not track
1252-
the artifactId).
1253-
2. **`.github/workflows/publish.yml`** — the `test-java-llama-langchain4j` job installs the
1254-
core Java jar, runs a **version-lockstep guard** (module version must equal core version,
1255-
else the build fails — the standalone module can't inherit `${project.version}` from a
1256-
reactor), then `mvn -f llama-langchain4j/pom.xml verify` (7 model-free mapping unit tests
1257-
run; the 4 model-backed integration tests self-skip without a GGUF; `verify` also builds the
1258-
javadoc jar so a release-time javadoc break is caught in PR CI). The
1259-
`publish-snapshot`/`publish-release` jobs `needs:` this job and, after the core `deploy`
1260-
(which installs the core jar locally), run a second `deploy` of the module at the same
1261-
version. A separate **`test-java-llama-langchain4j-integration`** job runs the model-backed
1262-
tests (chat/streaming/embedding/scoring adapters) by **reusing** the shared GGUF cache
1275+
1. **`llama-langchain4j/pom.xml`** — `net.ladenthin:llama-langchain4j`, `release 17`, a child of
1276+
`net.ladenthin:llama-parent` (so it **inherits `${project.version}`** — no hardcoded version,
1277+
no lockstep guard). Depends on `net.ladenthin:llama:${project.version}` and
1278+
`dev.langchain4j:langchain4j-core`. Builds its own sources/javadoc jars; the `release`
1279+
profile (GPG + Central Publishing) is **inherited from the parent**, not duplicated here.
1280+
Java package stays `net.ladenthin.llama.langchain4j` (package name need not track the artifactId).
1281+
2. **`.github/workflows/publish.yml`** — the `test-java-llama-langchain4j` job installs
1282+
parent + core into the local repo (`mvn -pl llama -am -DskipTests install`), then
1283+
`mvn -f llama-langchain4j/pom.xml verify` (7 model-free mapping unit tests run; the 4
1284+
model-backed integration tests self-skip without a GGUF; `verify` also builds the javadoc
1285+
jar so a release-time javadoc break is caught in PR CI). The `publish-snapshot`/
1286+
`publish-release` jobs `needs:` this job; deployment is a **single reactor**
1287+
`mvn -P release deploy` (no separate module deploy step — the parent's inherited `release`
1288+
profile signs and publishes parent + llama + llama-langchain4j together at the same version).
1289+
A separate **`test-java-llama-langchain4j-integration`** job runs the model-backed tests
1290+
(chat/streaming/embedding/scoring adapters) by **reusing** the shared GGUF cache
12631291
(`gguf-models-v1`, restore-only — no extra download) and the `Linux-x86_64-libraries` native
12641292
artifact: it `needs: [crosscompile-linux-x86_64, download-models]` (so the cache is already
1265-
populated and it runs in parallel), installs the core jar with the downloaded native lib
1266-
bundled, and passes the already-cached chat
1267-
(`REASONING_MODEL_NAME`), nomic-embedding and jina-reranker model paths via the module's
1293+
populated and it runs in parallel), installs parent+core with the downloaded native lib
1294+
bundled, and passes the already-cached chat (`REASONING_MODEL_NAME`), nomic-embedding and
1295+
jina-reranker model paths via the module's
12681296
`-Dnet.ladenthin.llama.langchain4j.{embedding,rerank}.model` / `net.ladenthin.llama.model.path`
12691297
properties. It is validation-only (not a release gate); a cold cache degrades to a self-skip.
1270-
3. **Version bumps** — when the root `pom.xml` `<version>` changes, bump
1271-
`llama-langchain4j/pom.xml` `<version>` to match in the same commit, or the lockstep guard
1272-
reds CI.
12731298
12741299
**Open follow-ups** (documented in `llama-langchain4j/README.md`): tool calling
12751300
(`ToolSpecification` ↔ jllama `ToolDefinition`), `response_format`/JSON mode, and multimodal

0 commit comments

Comments
 (0)