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?

3
  • share the snippet of your repository class and build.gradle file Commented Mar 4, 2021 at 8:39
  • @bhanu, i couldn't able to add complete file details here. Would u like to share me which part of build file u need.? Commented Mar 4, 2021 at 9:38
  • dependencies part of build.gradle file Commented Mar 5, 2021 at 13:44

2 Answers 2

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'
Sign up to request clarification or add additional context in comments.

Comments

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'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.