Lombok not workin with Intellij

已回答

I've being digging all issues similar to mine but didnt found anyway to solve my issue
Lombok is simply not wokring in any projects in my machine (it works on other machines just fine).
The problem: When im trying to run/build/etc.  i get errors like "cannot find symbol:   method getStatus()" or “cannot find symbol variable log” (while usign Slf4j). I've tried with the simplest example imaginable, just a single class with Getter and/or Slf4j and it wont compile, so its not the project, also the projects work fine in a LinuxVM and colleagues as well.
Im using a company macbook and the projects are all usign Springboot + Maven
I've tried the following SDKs: OpenJDK 23 / AMZ corretto 17, 19, 21.
Example of project:
SpringBoot 3.3.5
org.projectlombok 1.18.34
Maven (Bundled Maven 3) 3.9.9
IntelliJ IDEA 2024.3 (Ultimate Edition)


If you're going to give me the follwing suggestions, i already tried and it did not work :(

  • Build, Execution, Deployment > Compiler > Annotation Processors > Enable annotation processing is checked.
  • Lombok plugin is installed and updated (i've reinstalled it multiple times already trying to solve it)
  • Update Intellij Ultimate (already tried)
  • Check dependency on pom.xml (its perfect and as i stated, its working on other machines)
  • Invalidate caching (already tried multiple times)

It really is frustrating and im about to give up on IntelliJ. Ive lost the entire day yesterday trying everything to solve this, last resort is uninstalling.
If anyone thinks there is a way out of it but need more info just ask

11

Partial solution was to go down to version 24.3

 


 

0

Thank you very much edw grey  been on this for over 15 hours

0

Adding this in my pom.xml fixed this issue for me in my IntelliJ version 2024.3.1- 
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <annotationProcessorPaths>
            <path>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-configuration-processor</artifactId>
                <version>3.4.1</version>
            </path>
            <path>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.18.36</version>
            </path>
        </annotationProcessorPaths>
    </configuration>
</plugin>
 

0

Vashisthayashasvi – now you must right-click on your project in the project explorer > Run All Tests.

Make changes to your code.  use the Build menu, Build Project, Rebuild Project.  Write new classes, new tests.  Run the tests over and over again.

It will fail as we have all said.  it will modify the settings for the Settings > Build, Execution, Deployment > Compiler > Annotation Processors, notice what it does eventaully to your profile.

It is not an instant failure, but it is an inevitable failure.

0

I need this fixed and I need you to stop doing stupid things.

 

0

I'm currently going through the same issue. Any news on this yet?

0

What's even more weird is that Lombok doesn't work when running the application.
However, when I run using mvn commands, then it compiles just fine.

I think there has been some improvement to the issue (as getters work fine now). However, loggers still not resolved. Would very much love a rollback until this is resolved.

0

The snippet from Erickhc Dev works for me. Thanks bro.

 

<annotationProcessorPaths>
            <path>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-configuration-processor</artifactId>
            </path>
            <path>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>1.18.36</version>
            </path>
          </annotationProcessorPaths>
 

0

Roman Vatagin just confirming that adding the explicit lombok version to the pom does work for me.

IntelliJ IDEA 2024.3.1.1 (Ultimate Edition)
Build #IU-243.22562.218, built on December 18, 2024
 

0

If you are experiencing issues with Lombok, please check if you are affected by the known issue.

The fix for this issue has already been developed and will be available in one of the upcoming updates for IDEA 2024.3. In the meantime, please apply the workaround recommended in the YouTrack Issue.

If the workaround does not help, please let us know by posting a comment, describing your use-case here or in the YouTrack Issue linked above. Make sure to include the reproduction steps and / or a reproducer Project.

 

If the issue you are experiencing differs from the one above, please submit a separate support ticket or YouTrack Issue.

0

ajoutez juste : <version>${lombok.version}</version> dans le pom.xml si vous etes sur un projet Spring boot, donc en gros vous devez avoir : 
<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> // ligne a ajouter
          </path>
       </annotationProcessorPaths>
    </configuration>
</plugin>

0

If you're using Spring Boot and running into this problem, you can fix it by using the lombok version variable (that way Spring Boot can still manage the lombok version) in your plugin configuration.

<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>
<plugin>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-maven-plugin</artifactId>
  <configuration>
    <excludes>
      <exclude>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
      </exclude>
    </excludes>
  </configuration>
</plugin>
0

i have changed from 3.4.x upgraded version of spring-boot-starter-parent to 3.3.5 and worked for me.

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.3.5</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

1

I wasted 5 hours of my life on this stupid bug in IntelliJ. I tried everything from wiping out local indexes, m2 repo, jdk, uninstalled lombok plugin and reinstalling everything again but it didn't go away. I started getting this error after I upgraded from 2022 → 2024 version of IntelliJ. The only working solution for me was to add lombok in the pom.xml with scope as provided. Ultimately, I had to downgrade the version of IntelliJ version to 2022.3 to make it work. The issue is not fixed in 2024.3.1 and 2024.3.2. 

It seems intellij bundled with lombok plugin has this issue. Please check if that is the issue and fix it

Intellij Version: 2024.3.2, 2024.3.1
JDK: Tried with 18,17,21, 23

0

The fix has not yet been implemented in IDEA 2024.3, but it is available in the current EAP.

If you cannot use the workaround or it does not work for you, please consider deploying the EAP version of IDEA.

0

I'm running 2024.3.2 and I'm experiencing this problem.  

I find that if I comment the following section from the .idea/compiler.xml it works.

        <processorPath useClasspath="false">
          <entry name="$MAVEN_REPOSITORY$/org/projectlombok/lombok/unknown/lombok-unknown.jar" />
        </processorPath>

The fix is only temporary though.  Running build restores the XML section.  I need to set the file to read-only to force it to persist.

0

Joseph Glorioso As stated in my previous message, the fix for the issue is developed, but has not yet been added to IDEA 2024.3.

It is available in the EAP version, there's also a workaround that helps with the issue on IDEA 2024.3

0

I'm on v2024.3.2.1 and Lombok is still not working. Adding <version>${lombok.version}</version> into my pom.xml is a workaround. Thanks to Abhishek Sah for mentioning this above.

<build>
	<plugins>
		<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>
0

Rafael Pimenta Correct!

IDEA 2024.3.2.2 includes the fix for this issue.

0
This video helped me to solve this issue 
https://www.youtube.com/watch?v=poTDoN7JGCo&ab_channel=JavaGuides

Basicly is necessary get lombok dependency at the Maven Repository and add lombok version in the plugins section on pom file.

Here is the exemple:

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<version>1.18.36</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<annotationProcessorPaths>
						<path>
							<groupId>org.projectlombok</groupId>
							<artifactId>lombok</artifactId>
							<version>1.18.36</version>
						</path>
					</annotationProcessorPaths>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<excludes>
						<exclude>
							<groupId>org.projectlombok</groupId>
							<artifactId>lombok</artifactId>
							<version>1.18.36</version>
						</exclude>
					</excludes>
				</configuration>
			</plugin>
		</plugins>
	</build>
0

Same problem with 2024.3.2.1, still not fixed… thanks for the time lost InteliJ.. I'll just go the old way with getters written by myself.

I'll switch to VSCode . Ultimate and Riders are now ridden with bug and things that don't work anymore.

Edit : getters and setters works perfectly fine on VisualCode Studio…

 

0

K Jourdain As stated above, the issue has been fixed in IDEA 2024.3.2.2 - please update to the latest version!

If the issue persists, it likely has a different root cause, please share more details about the issue you're experiencing.

0

I have the same issue, with Lombok annotation and sometimes with mapstruct `@Mapper` annotation as well.

It started happening after I upgraded IntelliJ from 2023.3.8 to 2024.3.2.1.

My Stack:

  • Java 17 (Oracle)
  • Spring Boot 3.4.1
  • Project Lombok 1.18.36
  • Mapstruct 1.6.2
  • JetBrain IntelliJ IDEA 
          IntelliJ IDEA 2024.3.2.1 (Ultimate Edition)
          Build #IU-243.23654.153, built on January 23, 2025
0

Chef Ben H Regev This issue has been addressed in IDEA 2024.3.2.2 - please update to the latest version.

If the issue persists, it likely has a different root cause and should be reported as a separate problem.

0

The issue you're facing when using IntelliJ 2023 with JDK-23 can be resolved by simply upgrading to IntelliJ 2024.

0

I was able to solve this issue with Lombok by following a tutorial that a guy named Ramesh posted on Medium. It basically is doing everything that was said previously in this thread and also adding the lombok version to the annotationProcessorPaths and build > plugins on the pom.xml

0

Hi

Same issue with Mac. Current IntelliJ version is 2024.3.5. It won't work if I do not add 
 

<build>
  <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <annotationProcessorPaths>
                    <path>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-configuration-processor</artifactId>
                    </path>
                    <path>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                    </path>
                </annotationProcessorPaths>
                <basedir/>
                <mainOutputDirectory/>
                <mojoStatusPath/>
                <outputDirectory/>
                <projectArtifact/>
            </configuration>
        </plugin>
    </plugins>
</build>

I don't need to add this on a Windows machine with the same configuration. Is the issue still not fixed?

0

请先登录再写评论。