Java 11 + QueryDSL 4 + Gradle 5 + SpringBoot 2.1- not generating QClasses

Siwy picture Siwy · Jan 10, 2019 · Viewed 7.2k times · Source

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")
}

Answer

jtomaszk picture jtomaszk · Jan 15, 2019

You need to provide concrete annotation processor ':jpa'

annotationProcessor("com.querydsl:querydsl-apt:4.2.1:jpa")

that should work:

dependencies{
   annotationProcessor("org.projectlombok:lombok:1.18.4")
   annotationProcessor("com.querydsl:querydsl-apt:4.2.1:jpa")
   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("org.springframework.boot:spring-boot-starter-data-jpa:2.1.1.RELEASE")
   implementation("org.springframework.boot:spring-boot-starter-web:2.1.1.RELEASE")
}