Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

644
Views
Maven compiler plugin does not see Lombok's annotations

in my application I have 3 modules like this:

permissions (parent pom)
|---permission-api (just api, without main spring class)
|---permission-service (spring boot app)

In parent pom in main module I have pom which contains:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.6.3</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<modules>
    <module>permissions-api</module>
    <module>permissions-service</module>
</modules>

and some dependencies. Now I want to build my whole project with maven clean install. Permission-api module is build (there is no problem with lombok annotations). In pom only reference to lombok is:

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

Anyway when I try to build only permission-serivce or entire project, I've got compilation errors like this:

cannot find symbol
[ERROR]   symbol:   method getPermissionsList()
[ERROR]   location: variable employee of type permissions.model.entity.Employee

I know that I should add maven-compiler-plugin to pom.xml (I tried to add this to parent pom too) and I did but it does not help:

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
        </plugins>
    </build>

Can you tell me what am I doing wrong?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Dependency, as in projectlombok.org, should be in scope 'provided', meaning that it's required only for compilation, but not needed in runtime:

<dependencies>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.22</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

This should be enough.

over 4 years ago · Santiago Trujillo Report

0

Meanwhile I found a solution. Everything started to works when I add:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-envers</artifactId>
    <version>${hibernate.version}</version>
</dependency>

Probably that missing dependency was causing first compilation error and maven compiler incorectly showed next lombok "missing annotations" as compilation errors too.

over 4 years ago · Santiago Trujillo Report

0

When you use optional true, you are preventing dependency being transferred to its children transitively. Remove optional and you should be fine.

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
</dependency>

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!