spirngboot 3.3.1 + JDK17;
Problem occurred during migration from Springboot 2.7 to 3.3
my build.gradle.kts
enter image description hereplugins {
id("java")
id("org.springframework.boot") version "3.3.1"
id("io.spring.dependency-management") version "1.1.5"
}
group = "back.ecommerce"
version = "0.0.1-SNAPSHOT"
java {
sourceCompatibility = JavaVersion.VERSION_17
}
configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}
repositories {
mavenCentral()
maven {
setUrl("https://jitpack.io")
}
}
dependencyManagement {
imports {
mavenBom("io.awspring.cloud:spring-cloud-aws-dependencies:2.4.4")
}
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-validation")
// Logback Appender Discord
implementation("org.slf4j:slf4j-api:1.7.25")
implementation("com.github.napstr:logback-discord-appender:1.0.0")
implementation("net.logstash.logback:logstash-logback-encoder:7.3")
//Auth JWT
implementation("org.springframework.security:spring-security-crypto")
implementation("io.jsonwebtoken:jjwt:0.9.1")
//queryDSL
implementation("com.querydsl:querydsl-jpa:5.0.0")
annotationProcessor("com.querydsl:querydsl-apt:5.0.0")
annotationProcessor("jakarta.annotation:jakarta.annotation-api")
annotationProcessor("jakarta.persistence:jakarta.persistence-api")
//AOP
implementation("org.springframework.boot:spring-boot-starter-aop")
//AWS SQS
implementation("io.awspring.cloud:spring-cloud-starter-aws-messaging")
//Redis
implementation("org.springframework.boot:spring-boot-starter-data-redis")
//spring docs
implementation("org.springdoc:springdoc-openapi-ui:1.6.15")
//webflux(REST API Client)
implementation("org.springframework.boot:spring-boot-starter-webflux")
testImplementation("io.projectreactor:reactor-test")
annotationProcessor("org.projectlombok:lombok")
compileOnly("org.projectlombok:lombok")
runtimeOnly("com.mysql:mysql-connector-j")
testRuntimeOnly("com.h2database:h2")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
tasks.test {
useJUnitPlatform()
}
val querydslDir = file("build/generated/querydsl")
tasks.compileJava {
options.generatedSourceOutputDirectory.set(querydslDir)
doFirst {
querydslDir.mkdirs()
}
}
sourceSets["main"].java {
srcDir("build/generated/querydsl")
}
To migrate to Springboot 3.0, I have newly written from gadle.build to gardle.build.kts
Because the existing entity code is Java code, we used annotationProcessor instead of KPAT plugin.
//queryDSL
implementation("com.querydsl:querydsl-jpa:5.0.0")
annotationProcessor("com.querydsl:querydsl-apt:5.0.0")
annotationProcessor("jakarta.annotation:jakarta.annotation-api")
annotationProcessor("jakarta.persistence:jakarta.persistence-api")
I expecting generated QClass
2
Answers
There are so many solutions to solve this problem.
I also have the same problem with you at exact same version of Java and Spring boot version.
Have you tried to check the version of JDK in your IDE?
Solution 1.
Solution 2.
Solution 3. (If you are Windows user)
Solution 4.
I solved the problem with those kind of solutions.
Spring Boot 3+ based on Jakarta EE, so you should add classifier to querydsl-apt: