javamavenmaven-3lombok

mvn install produces compilation error for @Getter @Setter properties for Lombok properties


I encountered this when I was testing my application an mvn test would not run and produce compilation issues specifically at the properties which have the @Getter @Setter annotations of Lombok. There are no highlighting errors in the IDE as the Intelij plugin works but somehow maven is not able to find Lombok. I've seen posts that were similar to my issue but all of them had a different version of maven / lombok / maven-compiler. My Versions are Maven - 3.5 , Maven compiler - 3.7 , Lombok 1.16.20.

My Java Class with lombok anotations

@JsonProperty
@Getter @Setter private String name;


@JsonProperty
@Getter @Setter private String catType;


@JsonProperty
@Getter @Setter private String description;


@JsonProperty
@Getter @Setter private String intType;


@JsonProperty
@Getter @Setter private String numberCode;

when I run mvn install I get

> [my-path]/my-java.java:[86,29] cannot find symbol
[ERROR]   symbol:   method numberCode()
[ERROR]   location: variable source of type My-java
[my-path]/my-java.java:[86,29] cannot find symbol
[ERROR]   symbol:   method name()
[ERROR]   location: variable source of type My-java
[my-path]/my-java.java:[86,29] cannot find symbol
[ERROR]   symbol:   method catType()
[ERROR]   location: variable source of type My-java
[my-path]/my-java.java:[86,29] cannot find symbol
[ERROR]   symbol:   method description()
[ERROR]   location: variable source of type My-java 

Here Is my Pom.xml (as this was a very lengthy pom.xml I only shared what might matter in the context of this question)

    <lombok.version>1.18.0</lombok.version>
 <maven-clean-plugin.version>2.6.1</maven-clean-plugin.version>
        <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
        <maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
        <maven-enforcer-plugin.version>3.0.0-M1</maven-enforcer-plugin.version>
        <maven-resources-plugin.version>3.0.1</maven-resources-plugin.version>
        <maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
          <maven.version>3.0.0</maven.version>
        <java.version>1.8</java.version>
        <scala.version>2.12.1</scala.version>
        <node.version>v8.9.4</node.version>
        <yarn.version>v1.3.2</yarn.version>

  <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
            <scope>provided</scope>
        </dependency>

Solution

  • After seeing the comment from @DarrenForsythe I removed mapstruct annotationProcessorPaths from the configurations of maven-compiler It works just fine. If you are using any other annotation processors that may result in a conflict