我尝试生成查询类型类(例如 QUser
)但出现错误...
你可以在这里找到我的源代码:https://github.com/TheNakedMan/remindme.server/
我正在使用 IntelliJ IDEA,似乎我有可用的插件。 请帮助我。
日志消息:
/remindme.server/src/main/java/com/qoobico/remindme/server/repository/UserRepository.java Error:(21, 126) java: cannot find symbol symbol: class QUser
Error:(25, 62) java: cannot find symbol symbol: class QUser
location: interface com.qoobico.remindme.server.repository.UserRepository
更新:
在 LifeCycle->clean
并在 IntelliJ 中运行 apt:process
后,出现以下错误:
[ERROR] Failed to execute goal on project com.qoobico.remindme.server: Could not resolve dependencies for project com.qoobico.remindme.server:com.qoobico.remindme.server:war:1.0-SNAPSHOT: Could not find artifact com.qoobico.remindme.server:com.qoobico.remindme.server:jar:1.0-SNAPSHOT
最佳答案
在您的源代码中您没有导入生成的类,例如:
import com.qoobico.remindme.server.entity.QUser;
如果您想在不编译和/或安装包的情况下生成类,请使用 maven goal apt:process
。
您可以使用 IntelliJ 启动这样一个 maven 目标,使用 Maven Projects window .该窗口将向您显示所有可用目标。
在命令行上,您可以使用 mvn
cli,可以下载 here .
提示:来自 help plugin 的命令mvn help:describe -Dplugin=com.mysema.maven:apt-maven-plugin
将向您显示所有可用的 apt-maven-plugin 目标的列表。
您将输出目录配置为:target/generated-sources/java
要让您的 IDE 找到这些类,请将它们放入您的类路径中。某些 IDE(如 IntelliJ)会自动为 maven 项目执行此操作,因为该文件夹是默认文件夹。
关于java - QueryDsl 错误。未生成 Q 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36086193/