问题描述
当使用Lombok注释对方法或变量进行注释时,maven插件将通过处理JPA的源代码生成来进行投诉.
When a method or variable is annotated with Lombok annotation, the maven plugin will complain by processing the source generation for JPA.
我在控制台日志中遇到这种失败:
I get this kind of failure in the console logs:
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批注一起工作?
How to make the apt-maven-plugin and queryDSL processor for JPA annotations work together with lombok annotations ?
推荐答案
此解决方案对我有用.在您的apt-maven-plugin配置中添加lombok.launch.AnnotationProcessorHider$AnnotationProcessor
.
This solution worked for me.Add lombok.launch.AnnotationProcessorHider$AnnotationProcessor
in your apt-maven-plugin configuration.
<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
It seems also to be working the same way with gradle:See https://github.com/ewerk/gradle-plugins/issues/59#issuecomment-247047011
这篇关于如何使QueryDSL和Lombok一起工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!