Skip to content

feat(jdtls): add automatic Lombok detection and support#8031

Open
ilx wants to merge 2 commits intoanomalyco:devfrom
ilx:feat/lombok-auto-detection
Open

feat(jdtls): add automatic Lombok detection and support#8031
ilx wants to merge 2 commits intoanomalyco:devfrom
ilx:feat/lombok-auto-detection

Conversation

@ilx
Copy link

@ilx ilx commented Jan 12, 2026

Summary

Adds automatic Lombok detection and support for the JDTLS language server.

Changes

  • Auto-detect Lombok in pom.xml, build.gradle, build.gradle.kts
  • Download lombok.jar only when needed
  • Support both wrapper script and direct Java execution
  • Add proper error handling for download failures
  • Respect OPENCODE_DISABLE_LSP_DOWNLOAD flag

Improves upon #6434 by adding auto-detection instead of always enabling Lombok for all Java projects.

Fixes #8032

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Comment on lines +28 to +34
const pomPath = path.join(projectRoot, "pom.xml")
if (await pathExists(pomPath)) {
const content = await Bun.file(pomPath).text()
if (/<artifactId>\s*lombok\s*<\/artifactId>/.test(content)) {
return true
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lombok might not be explicitly in the pom.xml. It could be a transient dependency.

@theCat69
Copy link

theCat69 commented Feb 8, 2026

I just looked into your PR and I think it is needed to also handle gradle plugin for lombok.
For example in a gradle project, when using lombok, the current way of doing it is like so :

plugins {
    id 'java'
    id 'io.freefair.lombok' version "9.2.0"
}

I believe syntax is the same for gradle kotlin configuration.

I hope it helps.

PS: For transitive dependencies you can't detect them with a 100% confidence without using gradle or maven commands.

if (await pathExists(wrapperPath)) {
const args = [
// Add Lombok javaagent if enabled
...(lombokJarPath ? [`--jvm-arg=-javaagent:${lombokJarPath}`] : []),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ilx added 2 commits February 17, 2026 12:06
- Auto-detect Lombok in pom.xml, build.gradle, build.gradle.kts
- Download lombok.jar only when needed
- Support both wrapper script and direct Java execution
- Add proper error handling for download failures
- Respect OPENCODE_DISABLE_LSP_DOWNLOAD flag

Improves upon anomalyco#6434 by adding auto-detection instead of
always enabling Lombok for all Java projects.
It might be false positive if anyone mentions this string in a comment or unrelated to plugin usage, but that is not very likely and also does not harm.
@ilx ilx force-pushed the feat/lombok-auto-detection branch from a704c9e to e213953 Compare February 17, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]:jdtls should support lombok

3 participants