我们已经使用 maven 插件在我们的项目中配置了 QueryDSL 的生成:
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
<dependencies>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
在某些时候,我们对项目进行了更改,生成过程开始失败并出现此错误:
cannot find symbol import xxx.xxxx.xxxx.domain.QContact;
最佳答案
经过一番调查,这个问题是由一个被完全注释掉的类引起的。
例如:
//package xxx.xxxx.xxxxx;
////
//public class Test {
////
//}
如果将这样的类放入域包中,生成过程将失败。
好吧,另一方面,您的项目中不必存在此类类。
关于java - com.mysema.querydsl querydsl-apt 插件不生成 QueryDSL 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22467308/