解决lombok和mapstruct冲突,maven执行compile报错,提示找不到get/set方法

pom中导入lombok插件及依赖后,
maven执行compile报错,提示找不到get/set方法,原因是和mapstruct冲突。

解决方法:去掉annotationProcessorPaths节点就可以了

由如下pom.xml配置

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-compiler-plugin</artifactId>
     <version>3.6.1</version>
     <configuration>
         <source>1.8</source> <!-- or higher, depending on your project -->
         <target>1.8</target> <!-- or higher, depending on your project -->
         <annotationProcessorPaths>
             <path>
                 <groupId>org.mapstruct</groupId>
                 <artifactId>mapstruct-processor</artifactId>
                 <version>${org.mapstruct.version}</version>
             </path>
         </annotationProcessorPaths>
     </configuration>
 </plugin>

改为如下配置

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.7.0</version>
    <configuration>
        <encoding>UTF-8</encoding>
        <source>1.8</source> <!-- or higher, depending on your project -->
        <target>1.8</target> <!-- or higher, depending on your project -->
    </configuration>
</plugin>

就OK了

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页