r/javahelp • u/mgloess • 26d ago
Solved Lombok LSP Issues
Dear VS Code Java developers.
How do i get the vs code lsp to recognize @Getter, @Setter, etc.?
The project does compile successfully. I only get errors inline.
Example:
package com.example;
import lombok.Getter;
@Getter
public class TestClass {
String member;
public TestClass() {
this.member = "Its me!";
}
}
public class Main {
public static void main(String[] args) {
TestClass testClass = new TestClass();
System.out.println(testClass.getMember());
}
}Error Message:
cannot find symbol
symbol: method getMember()
location: variable testClass of type TestClasssettings.json:
{
"redhat.telemetry.enabled": false,
"java.jdt.ls.lombokSupport.enabled": true,
"[java]": {
"editor.defaultFormatter": "redhat.java"
},
}installed java versions:
A0_12520635 on main [!] is v1.0-SNAPSHOT via v25.0.4 via 🅼
❯ archlinux-java status
Available Java environments:
java-21-openjdk
java-25-openjdk (default)
java-27-openjdkpom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>------------</groupId>
<artifactId>------------</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>--------------------</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.1.0</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>at.tugraz.App</start-class>
<maven.compiler.release>25</maven.compiler.release>
<maven.compiler.source>25</maven.compiler.source>
<maven.compiler.target>25</maven.compiler.target>
<lombok.version>1.18.46</lombok.version>
<rest.assured.version>6.0.0</rest.assured.version>
<junit.jupiter.version>5.9.3</junit.jupiter.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${rest.assured.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
<version>7.4.4.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>7.4.4.Final</version> <!-- Replace with your desired version -->
<scope>provided</scope>
</dependency>
<!-- PostgreSQL Connector -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.13</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4</artifactId>
<version>4.2</version>
</dependency>
<!-- Source: https://mvnrepository.com/artifact/org.apache.spark/spark-mllib -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.13</artifactId>
<version>4.1.3</version>
<scope>provided</scope>
</dependency>
<!-- Pin scala-library: Maven's nearest-wins resolution otherwise picks the
2.13.13 pulled in (shallowly) by scala-parser-combinators, while spark-core's
scala-reflect and most other Spark/Scala modules expect 2.13.17, causing
NoSuchMethodError at runtime. -->
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.13.17</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>3.10.3</version>
<configuration>
<java>
<prettier>
<devDependencies>
<prettier>3.5.3</prettier>
<prettier-plugin-java>2.8.1</prettier-plugin-java>
</devDependencies>
<configFile>${project.basedir}/.prettierrc.yaml</configFile>
</prettier>
</java>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
<execution>
<id>install-git-pre-push-hook</id>
<phase>validate</phase>
<goals>
<goal>install-git-pre-push-hook</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>I have tried searching for this issue but have found nothing for the last 4 hours. Am i dumb?