JAVA/에러

'javax.persistence.Entity', Could not resolve all files for configuration ':compileClasspath'.

whyHbr 2024. 6. 10. 12:02
728x90
반응형

> Task :compileJava FAILED 1 actionable task: 1 executed FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileJava'. > Could not resolve all files for configuration ':compileClasspath'. > Could not find javax.persistence:javax.persistence-api:. Required by: project :

 

 Executing 'build'... > Task :compileJava FAILED 1 actionable task: 1 executed FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileJava'. > java.lang.NoClassDefFoundError: javax/persistence/Entity

 

Unable to load class 'javax.persistence.Entity'. This is an unexpected error. Please file a bug containing the idea.log file

 

등... Querydsl 설정하면서 생긴 에러

 

수정전:

// queryDSL 설정
    implementation "com.querydsl:querydsl-jpa"
    implementation "com.querydsl:querydsl-core"
    implementation "com.querydsl:querydsl-collections"
    annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jpa" // querydsl JPAAnnotationProcessor 사용 지정
    annotationProcessor "jakarta.annotation:jakarta.annotation-api" // java.lang.NoClassDefFoundError (javax.annotation.Generated) 대응 코드
    annotationProcessor "jakarta.persistence:jakarta.persistence-api" // java.lang.NoClassDefFoundError (javax.annotation.Entity) 대응 코드

 

 

수정 후

// queryDSL 설정
    implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
    implementation "com.querydsl:querydsl-core"
    implementation "com.querydsl:querydsl-collections"
    annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta" // querydsl JPAAnnotationProcessor 사용 지정
    annotationProcessor "jakarta.annotation:jakarta.annotation-api" // java.lang.NoClassDefFoundError (javax.annotation.Generated) 대응 코드
    annotationProcessor "jakarta.persistence:jakarta.persistence-api" // java.lang.NoClassDefFoundError (javax.annotation.Entity) 대응 코드

 

 

스프링부트 버전 문제 같다

 

jpa -> jakarta 로 변경해주니 

728x90