feat: auto-detect Lombok and add -javaagent at startup (#74) #76

Merged
fred merged 1 commit from feature/74-lombok-support into main 2026-03-09 09:26:23 +00:00
Collaborator

Summary

  • Launcher: Auto-detect Lombok dependency in pom.xml/build.gradle, find JAR in ~/.m2/repository, add -javaagent automatically
  • Config: Support ~/.jdt-mcp/jdt-mcp.ini for manual VM args + JDTMCP_VMARGS env var + JDTMCP_NO_LOMBOK=1 opt-out
  • Runtime: Log Lombok agent status at startup, warn if Lombok in classpath but agent not loaded

Problem

JDT needs the Lombok agent as -javaagent to see generated members (getters, constructors, loggers). Without it, Lombok projects show hundreds of phantom compile errors and refactorings fail with AssertionFailedException in TextFileChange.releaseDocument().

Test plan

  • Start jdtls-mcp in a Lombok project → verify INFO: Lombok detected, adding -javaagent:... on stderr
  • Verify jdt_get_compilation_errors shows 0 errors for Lombok modules
  • Run a rename refactoring (preview=false) → verify no AssertionFailedException
  • Start in non-Lombok project → verify no Lombok messages
  • Set JDTMCP_NO_LOMBOK=1 → verify auto-detection is skipped
  • Add custom arg to ~/.jdt-mcp/jdt-mcp.ini → verify it's passed to JVM
  • Set JDTMCP_VMARGS="-Xmx4g" → verify it's passed to JVM

Closes #74

🤖 Generated with Claude Code

## Summary - **Launcher**: Auto-detect Lombok dependency in `pom.xml`/`build.gradle`, find JAR in `~/.m2/repository`, add `-javaagent` automatically - **Config**: Support `~/.jdt-mcp/jdt-mcp.ini` for manual VM args + `JDTMCP_VMARGS` env var + `JDTMCP_NO_LOMBOK=1` opt-out - **Runtime**: Log Lombok agent status at startup, warn if Lombok in classpath but agent not loaded ## Problem JDT needs the Lombok agent as `-javaagent` to see generated members (getters, constructors, loggers). Without it, Lombok projects show hundreds of phantom compile errors and refactorings fail with `AssertionFailedException` in `TextFileChange.releaseDocument()`. ## Test plan - [ ] Start jdtls-mcp in a Lombok project → verify `INFO: Lombok detected, adding -javaagent:...` on stderr - [ ] Verify `jdt_get_compilation_errors` shows 0 errors for Lombok modules - [ ] Run a rename refactoring (preview=false) → verify no AssertionFailedException - [ ] Start in non-Lombok project → verify no Lombok messages - [ ] Set `JDTMCP_NO_LOMBOK=1` → verify auto-detection is skipped - [ ] Add custom arg to `~/.jdt-mcp/jdt-mcp.ini` → verify it's passed to JVM - [ ] Set `JDTMCP_VMARGS="-Xmx4g"` → verify it's passed to JVM Closes #74 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat: auto-detect Lombok and add -javaagent at startup (#74)
All checks were successful
Build and Release / build (push) Successful in 3m32s
0163a7b865
JDT needs the Lombok agent to see generated members (getters, constructors,
loggers). Without it, Lombok projects show phantom compile errors and
refactorings fail with AssertionFailedException.

Changes:
- Launcher: scan pom.xml/build.gradle for Lombok, find JAR in ~/.m2,
  add -javaagent automatically. Support ~/.jdt-mcp/jdt-mcp.ini for
  manual VM args and JDTMCP_VMARGS env var. JDTMCP_NO_LOMBOK=1 to opt out.
- HeadlessApplication: log Lombok agent status at startup
- ProjectImporter: warn if Lombok in classpath but agent not loaded

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fred merged commit 0163a7b865 into main 2026-03-09 09:26:23 +00:00
fred deleted branch feature/74-lombok-support 2026-03-09 09:26:23 +00:00
Sign in to join this conversation.
No description provided.