Files
lancedb/java
wangshun d0dfa0d8f0 fix(java): fall back to curl when Maven Wrapper wget fails (#5231)
Fixes #5224

The Java beta release job stopped before Maven started. The job log
shows that the wrapper cache was empty and wget failed to fetch the
Maven distribution. The wrapper exited immediately even when curl was
available. [Issue #5224](https://github.com/lancedb/lancedb/issues/5224)

Use the existing curl download path when wget fails and curl is
installed. Keep wget as the first choice and continue using the same
distribution URL, archive validation, and cache. The wrapper still exits
with an error if it cannot download the archive.

Tests: `python3 -m unittest discover -s ci/tests -p
test_maven_wrapper.py -v`.
Result: Base: python3 -m unittest discover -s ci/tests -p
test_maven_wrapper.py -v exited 1. The fallback regression reproduced
the terminal wget error, and the successful-wget case passed.
Result: Patched: python3 -m unittest discover -s ci/tests -p
test_maven_wrapper.py -v exited 0. Both wrapper tests passed, including
the cached invocation in the fallback test.
Result: Patched: python3 -m unittest discover -s ci/tests -v exited 0
with Ran 40 tests and OK.
Result: Base: (cd java && JAVA_HOME=/usr/lib/jvm/temurin-17-jdk-amd64
./mvnw --batch-mode test -pl lancedb-core) exited 0 with 37 tests, 0
failures, 0 errors, and 0 skipped.
Result: Patched: (cd java && JAVA_HOME=/usr/lib/jvm/temurin-17-jdk-amd64
./mvnw --batch-mode -Dspotless.skip=true clean test -pl lancedb-core)
exited 0 with 37 tests, 0 failures, 0 errors, and 0 skipped. Surefire
XML reports are in java/lancedb-core/target/surefire-reports/.
Result: Patched: The Temurin 8 cold-cache deployment command in
setup_steps exited 0 and reported BUILD SUCCESS for lancedb-parent and
lancedb-core after logging 'wget download failed, trying curl'. Both
POMs and all three JARs were present in the file repository.
Result: Patched: uvx ruff format --check ci/tests/test_maven_wrapper.py,
uvx ruff check ci/tests/test_maven_wrapper.py, sh -n java/mvnw,
shellcheck java/mvnw, and git diff --check passed.
Regression coverage: `ci/tests/test_maven_wrapper.py`.
<!-- oss-scout-job:job-71b2ce3e-46b8-467c-8342-2f1d491dd63c -->

Signed-off-by: wangshun <96341168+xixi-box@users.noreply.github.com>
2026-11-30 20:18:20 +08:00
..

LanceDB Java Enterprise Client

Installation

Stable releases of com.lancedb:lancedb-core are published to Maven Central.

Beta releases are published to https://maven.fury.io/lancedb/ instead. They depend on Lance beta releases, which are published to https://maven.lance.org. To use a beta, add both repositories alongside Maven Central:

<repositories>
    <repository>
        <id>lancedb</id>
        <url>https://maven.fury.io/lancedb/</url>
    </repository>
    <repository>
        <id>lance</id>
        <url>https://maven.lance.org</url>
    </repository>
</repositories>

For Gradle:

repositories {
    mavenCentral()
    maven { url = uri("https://maven.fury.io/lancedb/") }
    maven { url = uri("https://maven.lance.org") }
}

Use an explicit version, including the full -beta.N suffix. Beta versions are Maven releases, not SNAPSHOT versions.

Configuration and Initialization

LanceDB Cloud (legacy)

For LanceDB Cloud, the legacy hosted service, use the simplified builder API:

import com.lancedb.LanceDbNamespaceClientBuilder;
import org.lance.namespace.LanceNamespace;

// If your DB url is db://example-db, then your database here is example-db
LanceNamespace namespaceClient = LanceDbNamespaceClientBuilder.newBuilder()
    .apiKey("your_lancedb_cloud_api_key")
    .database("your_database_name")
    .build();

LanceDB Enterprise

For LanceDB Enterprise deployments, use your custom endpoint:

LanceNamespace namespaceClient = LanceDbNamespaceClientBuilder.newBuilder()
    .apiKey("your_lancedb_enterprise_api_key")
    .database("your_database_name")
    .endpoint("<your_enterprise_endpoint>")
    .build();

RTE write path

Most table operations reach LanceDB through the LanceNamespace above, which is generated from the Lance Namespace specification. The RTE LSM routes are not part of that specification, so they are issued through a separate client:

import com.lancedb.LanceDbRestClient;
import com.lancedb.LanceDbTableRTE;
import com.lancedb.RTEWriteSpec;

LanceDbRestClient client = LanceDbNamespaceClientBuilder.newBuilder()
    .apiKey("your_lancedb_cloud_api_key")
    .database("your_database_name")
    .buildRestClient();

LanceDbTableRTE rte = new LanceDbTableRTE(client, "my_table");

// Route future merge_insert upserts through the RTE, hash-bucketed by `id`.
rte.enableRTE(RTEWriteSpec.bucket("id", 16));

// ... merge_insert traffic ...

// Converge the fresh tier into the base table.
rte.checkpointRTE();

// Inspect live per-table-shard state.
rte.getRTEStats().ifPresent(stats -> stats.tableShards().forEach(tableShard ->
    System.out.println(tableShard.shardId() + ": " + tableShard.sstables().size() + " SSTables")));

client.close();

maintainedIndexes is tri-state, and the null default is the opposite of what a Java reader usually expects:

Value Meaning
unset (null) Maintain every index the table has, including ones created later
Collections.emptyList() Maintain none
Arrays.asList("id_idx") Maintain exactly those

Development

The parent POM includes https://maven.lance.org to resolve Lance beta and RC dependencies. Use an explicit lance-core.version; numbered beta and RC versions are Maven releases, not snapshots. Maven Central remains available for stable and historical versions, as well as other dependencies.

Build:

./mvnw install -pl lancedb-core -am

Run tests:

./mvnw test -pl lancedb-core