找不到org.mapstruct包。或者运行行报红色错误。
    原因是没有给maven配置注解处理器,需要同时配置mapstruct和lombok
    image.png

    1. <build>
    2. <finalName>${artifactId}</finalName>
    3. <plugins>
    4. <plugin>
    5. <groupId>org.apache.maven.plugins</groupId>
    6. <artifactId>maven-compiler-plugin</artifactId>
    7. <version>3.8.1</version>
    8. <configuration>
    9. <source>1.8</source>
    10. <target>1.8</target>
    11. <annotationProcessorPaths>
    12. <path>
    13. <groupId>org.projectlombok</groupId>
    14. <artifactId>lombok</artifactId>
    15. <version>1.18.16</version>
    16. </path>
    17. <path>
    18. <groupId>org.mapstruct</groupId>
    19. <artifactId>mapstruct-processor</artifactId>
    20. <version>${org.mapstruct.version}</version>
    21. </path>
    22. <!-- other annotation processors -->
    23. </annotationProcessorPaths>
    24. <encoding>UTF-8</encoding>
    25. </configuration>
    26. </plugin>