The Problem
Java and Scala IDEs depend on syncing with your build tool to understand the project structure. This sync is traditionally a blocking operation — often taking minutes on large codebases — and it’s brittle: when it fails or gets stuck, your IDE is useless until you fix it. This was tolerable when all code editing was done manually by developers. It’s not tolerable when an AI agent can implement a feature faster than your IDE can finish syncing. The JVM is an incredibly powerful platform, but its tooling hasn’t kept pace with how code is written today: remote environments, fast iteration cycles, and codebases measured in millions of lines.The Approach
Metals v2 indexes source files directly, bypassing the build for core navigation. Open a repo with 10 million lines of code and you’re up and running within 20 seconds — no build server required, no need for the code to compile first.- Cold start: ~1 million lines per second
- After initial index: Navigation is instant
-sourcepath option to resolve symbols efficiently
directly from source. More architectural details will be shared in the future.
Metals v2 is developed in scalameta/metals,
the same repository as Metals v1, the official
Scala language server. While v1 remains the stable choice for smaller projects,
v2 is purpose-built for large codebases where build-dependent tooling becomes a
bottleneck.
Fast
Indexes ~1M lines/second. Usable in 10-20s even on massive codebases.
Build-Independent
Navigation works immediately. Build integration optional for high-fidelity analysis and testing/debugging.
Real-time Diagnostics
Errors appear as you type, not after you save and wait for compilation.
Bazel Friendly
Import any symbol in the repo. Run Gazelle later to update your BUILD files.
Installation
Build Tool Integration
Build integration is optional but required for 3rd-party deps and test/debug.| Build Tool | Status |
|---|---|
| sbt | Supported |
| Mill | Supported |
| Bazel | Setup required |
| Gradle | Setup required |
| Maven | Setup required |
Feature Support
| Feature | Java | Scala |
|---|---|---|
| Diagnostics | ||
| Go to definition | ||
| Find references | ||
| Find implementations |
3rd-Party Dependencies
Metals v2 indexes 1st-party sources out of the box. For 3rd-party dependencies, create a.metals/mbt.json file:
Generating mbt.json for Maven/Gradle
For Maven and Gradle projects, you can generatembt.json automatically using the extract-mbt.ts script.
Install Bun:
pom.xml) or Gradle (build.gradle) and writes .metals/mbt.json with all resolved dependencies.
Options:
--mavenor--gradleto force a specific build tool--sourcesto download source JARs before extraction
Generated Code
Generated sources (e.g. from Protobuf) require a BSP server. As a workaround, add them as entries inmbt.json.