Java 11 + QueryDSL 4 + Gradle 5 + SpringBoot 2.1-不生成QClass [英] Java 11 + QueryDSL 4 + Gradle 5 + SpringBoot 2.1- not generating QClasses

查看:268
本文介绍了Java 11 + QueryDSL 4 + Gradle 5 + SpringBoot 2.1-不生成QClass的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 QueryDSL,Gradle和Springboot 集成到标题中的版本中. 我将注解处理器添加到了gradle中,但是Intellij仍然没有生成QClasses.我尝试了来自社区的建议,以使用插件"gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin" 但这没有帮助.

I’m trying to integrate QueryDSL, Gradle and Springboot in versions from title. I added annotationProcessors to gradle but Intellij is still not generating the QClasses. I tried sugesstions from community to use the plugin ‘gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin’ but this did not help.

dependencies{
   annotationProcessor("org.projectlombok:lombok:1.18.4")
   annotationProcessor("com.querydsl:querydsl-apt:4.2.1")
   annotationProcessor("org.springframework.boot:spring-boot-starter-data-jpa:2.1.1.RELEASE")

   compileOnly("org.projectlombok:lombok:1.18.4")
   implementation("com.querydsl:querydsl-jpa:4.2.1")
   implementation("com.querydsl:querydsl-apt:4.2.1:jpa")
   implementation("org.springframework.boot:spring-boot-starter-data-jpa:2.1.1.RELEASE")
   implementation("org.springframework.boot:spring-boot-starter-web:2.1.1.RELEASE")
}

推荐答案

我将为您提供我的工作配置:

I will give you my working configuration :

ext {
    queryDslVersion = '4.2.1'
    lombokVersion = '1.8.6'
}
// https://stackoverflow.com/questions/42441844/annotation-processor-in-intellij-and-gradle/54611475#54611475
compileJava {
    options.annotationProcessorPath = configurations.annotationProcessor
}

dependencies {
  // ...

    compile(
            "com.querydsl:querydsl-core:${queryDslVersion}",
            "com.querydsl:querydsl-jpa:${queryDslVersion}"
    )

    compileOnly "org.projectlombok:lombok:${lombokVersion}"

    annotationProcessor "com.querydsl:querydsl-apt:${queryDslVersion}:jpa",
            "org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final",
            "javax.annotation:javax.annotation-api:1.3.2",
            "org.projectlombok:lombok:${lombokVersion}"
}

使用Gradle 5.2 +

这篇关于Java 11 + QueryDSL 4 + Gradle 5 + SpringBoot 2.1-不生成QClass的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆