Lombok + Vaadin 25.2.1 issues (production build)

Lombok dependency works at runtime, but is somehow is not resolved at production build time.
Relevant pom snippets:

    <properties>
        <java.version>25</java.version>
        <vaadin.version>25.2.1</vaadin.version>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>4.1.0</version>
    </parent>

        <!-- Lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>

Annotated GreetService with @Log and added log.info(...)
Run: Successful. I see the log.info output on the console

Trigger production build with mvn clean package as mentioned here
Got this

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.136 s
[INFO] Finished at: 2026-07-08T19:14:52+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.15.0:compile (default-compile) on project lombok-test: Compilation failure: Compilation failure: 
[ERROR] /Users/maneesh/VaadinProjects/LombokTest/src/main/java/com/example/application/GreetService.java:[14,13] cannot find symbol
[ERROR]   symbol:   variable log
[ERROR]   location: class com.example.application.GreetService
[ERROR] /Users/maneesh/VaadinProjects/LombokTest/src/main/java/com/example/application/GreetService.java:[17,13] cannot find symbol
[ERROR]   symbol:   variable log
[ERROR]   location: class com.example.application.GreetService

I just can’t figure out why.

A full build log might help to understand what’s the problem.

Also, by “run”, you mean starting the application from the IDE or executing it with Maven?

I guess you already checked the lombok docs for Maven

TLDR; it works when configured correctly.

Without seeing your full pom - I would say you are missing the mandatory annotation processor configuration Marco has mentioned.

The problem occures at a production build because spring boot removes optional dependencies by default now.

1 Like