1

i am using gradle6+, openjdk11 and querydsl 4.2.x for a springboot project, facing an issue like below

Caused by: java.lang.ClassNotFoundException: com.querydsl.apt.jpa.JPAAnnotationProcessor

in gradle script, have added

annotationProcessor 'com.querydsl:querydsl-apt:4.2.1:jpa'
    annotationProcessor "javax.annotation:javax.annotation-api:1.3.1"
    annotationProcessor 'org.springframework.boot:spring-boot-starter-data-jpa'
    compile("com.querydsl:querydsl-core:${project.querydsl}")
    compile("com.querydsl:querydsl-jpa:${project.querydsl}")

Can someone kindly let me help solving the issue?

Vijay
  • 1,026
  • 3
  • 11
  • 28

2 Answers2

1

I solved and able to compile the QClasses without this JPAProcessor in gradle build file. Looks to be with latest versions, we dont need this JPAProcessor while QClasses getting compiled. Just by placing the annotation processor as dependency is fine. The Java compile is able to create QClasses. I just used

annotationProcessor("com.querydsl:querydsl-apt:4.2.1:jpa")
annotationProcessor group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: project.springBoot
    annotationProcessor group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
    annotationProcessor group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.2.Final'
Vijay
  • 1,026
  • 3
  • 11
  • 28
1

Here, I only needed of three lines (once that I already had spring-boot-starter-data-jpa on the project):

implementation 'org.springframework.boot:spring-boot-starter-data-jpa:2.5.6'
annotationProcessor 'org.springframework.boot:spring-boot-starter-data-jpa:2.5.6'
implementation 'com.querydsl:querydsl-jpa:5.0.0'
annotationProcessor 'com.querydsl:querydsl-apt:5.0.0:jpa'
rios0rios0
  • 735
  • 7
  • 20