当使用Lombok注释注释方法或变量时,maven插件将通过处理JPA的源代码来进行投诉.
我在控制台日志中遇到这种情况:
symbol: class __ location: class ServiceBaseMessage C:\workspaces\[...]\service\ServiceBaseMessage.java:44: error: cannot find symbol @Getter(onMethod = @__({ @JsonProperty("TYPE") }))
如何使用JPA注释的apt-maven-plugin和queryDSL处理器与lombok注释一起工作?
解决方法
这个解决方案对我有用.
在apt-maven-plugin配置中添加lombok.launch.AnnotationProcessorHider $AnnotationProcessor.
在apt-maven-plugin配置中添加lombok.launch.AnnotationProcessorHider $AnnotationProcessor.
<plugin> <groupId>com.mysema.maven</groupId> <artifactId>apt-maven-plugin</artifactId> <executions> <execution> <goals> <goal>process</goal> </goals> <configuration> <outputDirectory>target/generated-sources/java</outputDirectory> <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor,lombok.launch.AnnotationProcessorHider$AnnotationProcessor</processor> </configuration> </execution> </executions> </plugin>
它似乎也与gradle一样工作:
见https://github.com/ewerk/gradle-plugins/issues/59#issuecomment-247047011