인프런 커뮤니티 질문&답변

cwj님의 프로필 이미지

작성한 질문수

실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화

querydsl 설정관련 질문드립니다.

작성

·

15K

1

현재 build.gradle에서  querydsl 환경설정을 하고 있는데 에러가 있어서 질문드립니다.

아래와 같이 build.gradle 작성했고 reimport 후 compileQuerydsl로 Q클래스들을 생성하였습니다. 하지만 빌드시 에러가 발생하는데 관련 자료를 찾는데 어려움이 있습니다..ㅜ (err msg 아래 첨부하였습니다.)

어떻게 해야할까요..?

개발환경>

spring boot 2.3

gradle 6.0.1

build.gradle===================================================================

/*
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.10"
}
}
*/


plugins {
id 'org.springframework.boot' version '2.2.3.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
id 'idea'
}

//apply plugin: "com.ewerk.gradle.plugins.querydsl"


group = 'com.gabia.project'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}


dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'mysql:mysql-connector-java'
testRuntimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.5.7'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
compile("com.querydsl:querydsl-jpa") // querydsl
compile("com.querydsl:querydsl-apt") // querydsl

}

test {
useJUnitPlatform()
}


def querydslSrcDir = 'src/main/generated'

querydsl {
library = "com.querydsl:querydsl-apt"
jpa = true
querydslSourcesDir = querydslSrcDir
}

compileQuerydsl{
options.annotationProcessorPath = configurations.querydsl
}

configurations {
querydsl.extendsFrom compileClasspath
}

sourceSets {
main {
java {
srcDirs = ['src/main/java', querydslSrcDir]
}
}
}

/*

//querydsl 추가
def querydslDir = 'src/main/generated'
querydsl {
library = "com.querydsl:querydsl-apt"
jpa = true
querydslSourcesDir = querydslDir
}
sourceSets {
main {
java {
srcDirs = ['src/main/java', querydslDir]
}
}
}
compileQuerydsl{
options.annotationProcessorPath = configurations.querydsl
}
configurations {
querydsl.extendsFrom compileClasspath
}*/


==================================================================

err msg>>>
> Task :compileQuerydslJava FAILED C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:3: error: package com.querydsl.core.types does not exist import static com.querydsl.core.types.PathMetadataFactory.*; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:7: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.PathMetadata; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:8: error: package javax.annotation does not exist import javax.annotation.Generated; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:9: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.Path; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:10: error: package com.querydsl.core.types.dsl does not exist import com.querydsl.core.types.dsl.PathInits; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:17: error: cannot find symbol public class QMember extends EntityPathBase<Member> { ^ symbol: class EntityPathBase C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:16: error: cannot find symbol @Generated("com.querydsl.codegen.EntitySerializer") ^ symbol: class Generated C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:17: error: cannot find symbol public class QMember extends EntityPathBase<Member> { ^ symbol: class Member C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:23: error: cannot find symbol public final StringPath department = createString("department"); ^ symbol: class StringPath location: class QMember C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:25: error: cannot find symbol public final StringPath id = createString("id"); ^ symbol: class StringPath location: class QMember C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:27: error: cannot find symbol public final StringPath name = createString("name"); ^ symbol: class StringPath location: class QMember C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:29: error: cannot find symbol public final ListPath<RecruitMember, QRecruitMember> recruitMembers = this.<RecruitMember, QRecruitMember>createList("recruitMembers", RecruitMember.class, QRecruitMember.class, PathInits.DIRECT2); ^ symbol: class ListPath location: class QMember C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:29: error: cannot find symbol public final ListPath<RecruitMember, QRecruitMember> recruitMembers = this.<RecruitMember, QRecruitMember>createList("recruitMembers", RecruitMember.class, QRecruitMember.class, PathInits.DIRECT2); ^ symbol: class RecruitMember location: class QMember C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRecruitMember.java:3: error: package com.querydsl.core.types does not exist import static com.querydsl.core.types.PathMetadataFactory.*; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRecruitMember.java:7: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.PathMetadata; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRecruitMember.java:8: error: package javax.annotation does not exist import javax.annotation.Generated; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRecruitMember.java:9: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.Path; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRecruitMember.java:10: error: package com.querydsl.core.types.dsl does not exist import com.querydsl.core.types.dsl.PathInits; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRecruitMember.java:17: error: cannot find symbol public class QRecruitMember extends EntityPathBase<RecruitMember> { ^ symbol: class EntityPathBase C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRecruitMember.java:16: error: cannot find symbol @Generated("com.querydsl.codegen.EntitySerializer") ^ symbol: class Generated C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRecruitMember.java:17: error: cannot find symbol public class QRecruitMember extends EntityPathBase<RecruitMember> { ^ symbol: class RecruitMember C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:31: error: cannot find symbol public final ListPath<Review, QReview> reviews = this.<Review, QReview>createList("reviews", Review.class, QReview.class, PathInits.DIRECT2); ^ symbol: class ListPath location: class QMember C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:31: error: cannot find symbol public final ListPath<Review, QReview> reviews = this.<Review, QReview>createList("reviews", Review.class, QReview.class, PathInits.DIRECT2); ^ symbol: class Review location: class QMember C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:3: error: package com.querydsl.core.types does not exist import static com.querydsl.core.types.PathMetadataFactory.*; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:7: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.PathMetadata; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:8: error: package javax.annotation does not exist import javax.annotation.Generated; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:9: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.Path; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:10: error: package com.querydsl.core.types.dsl does not exist import com.querydsl.core.types.dsl.PathInits; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:17: error: cannot find symbol public class QReview extends EntityPathBase<Review> { ^ symbol: class EntityPathBase C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:16: error: cannot find symbol @Generated("com.querydsl.codegen.EntitySerializer") ^ symbol: class Generated C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:17: error: cannot find symbol public class QReview extends EntityPathBase<Review> { ^ symbol: class Review C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:37: error: cannot find symbol public QMember(Path<? extends Member> path) { ^ symbol: class Path location: class QMember C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:37: error: cannot find symbol public QMember(Path<? extends Member> path) { ^ symbol: class Member location: class QMember C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMember.java:41: error: cannot find symbol public QMember(PathMetadata metadata) { ^ symbol: class PathMetadata location: class QMember C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:21: error: cannot find symbol private static final PathInits INITS = PathInits.DIRECT2; ^ symbol: class PathInits location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:25: error: cannot find symbol public final StringPath comment = createString("comment"); ^ symbol: class StringPath location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:27: error: cannot find symbol public final DatePath<java.time.LocalDate> date = createDate("date", java.time.LocalDate.class); ^ symbol: class DatePath location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:29: error: cannot find symbol public final NumberPath<Integer> id = createNumber("id", Integer.class); ^ symbol: class NumberPath location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:3: error: package com.querydsl.core.types does not exist import static com.querydsl.core.types.PathMetadataFactory.*; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:7: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.PathMetadata; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:8: error: package javax.annotation does not exist import javax.annotation.Generated; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:9: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.Path; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:10: error: package com.querydsl.core.types.dsl does not exist import com.querydsl.core.types.dsl.PathInits; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:17: error: cannot find symbol public class QRestaurant extends EntityPathBase<Restaurant> { ^ symbol: class EntityPathBase C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:16: error: cannot find symbol @Generated("com.querydsl.codegen.EntitySerializer") ^ symbol: class Generated C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:17: error: cannot find symbol public class QRestaurant extends EntityPathBase<Restaurant> { ^ symbol: class Restaurant C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:35: error: cannot find symbol public final ListPath<ReviewImg, QReviewImg> reviewImgs = this.<ReviewImg, QReviewImg>createList("reviewImgs", ReviewImg.class, QReviewImg.class, PathInits.DIRECT2); ^ symbol: class ListPath location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:35: error: cannot find symbol public final ListPath<ReviewImg, QReviewImg> reviewImgs = this.<ReviewImg, QReviewImg>createList("reviewImgs", ReviewImg.class, QReviewImg.class, PathInits.DIRECT2); ^ symbol: class ReviewImg location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:3: error: package com.querydsl.core.types does not exist import static com.querydsl.core.types.PathMetadataFactory.*; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:7: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.PathMetadata; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:8: error: package javax.annotation does not exist import javax.annotation.Generated; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:9: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.Path; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:10: error: package com.querydsl.core.types.dsl does not exist import com.querydsl.core.types.dsl.PathInits; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:17: error: cannot find symbol public class QReviewImg extends EntityPathBase<ReviewImg> { ^ symbol: class EntityPathBase C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:16: error: cannot find symbol @Generated("com.querydsl.codegen.EntitySerializer") ^ symbol: class Generated C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:17: error: cannot find symbol public class QReviewImg extends EntityPathBase<ReviewImg> { ^ symbol: class ReviewImg C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:37: error: cannot find symbol public final NumberPath<Integer> star = createNumber("star", Integer.class); ^ symbol: class NumberPath location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:43: error: cannot find symbol public QReview(Path<? extends Review> path) { ^ symbol: class Path location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:43: error: cannot find symbol public QReview(Path<? extends Review> path) { ^ symbol: class Review location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:47: error: cannot find symbol public QReview(PathMetadata metadata) { ^ symbol: class PathMetadata location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:51: error: cannot find symbol public QReview(PathMetadata metadata, PathInits inits) { ^ symbol: class PathMetadata location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:51: error: cannot find symbol public QReview(PathMetadata metadata, PathInits inits) { ^ symbol: class PathInits location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:55: error: cannot find symbol public QReview(Class<? extends Review> type, PathMetadata metadata, PathInits inits) { ^ symbol: class Review location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:55: error: cannot find symbol public QReview(Class<? extends Review> type, PathMetadata metadata, PathInits inits) { ^ symbol: class PathMetadata location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReview.java:55: error: cannot find symbol public QReview(Class<? extends Review> type, PathMetadata metadata, PathInits inits) { ^ symbol: class PathInits location: class QReview C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:21: error: cannot find symbol private static final PathInits INITS = PathInits.DIRECT2; ^ symbol: class PathInits location: class QReviewImg C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:25: error: cannot find symbol public final NumberPath<Integer> id = createNumber("id", Integer.class); ^ symbol: class NumberPath location: class QReviewImg C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:29: error: cannot find symbol public final StringPath url = createString("url"); ^ symbol: class StringPath location: class QReviewImg C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:35: error: cannot find symbol public QReviewImg(Path<? extends ReviewImg> path) { ^ symbol: class Path location: class QReviewImg C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:35: error: cannot find symbol public QReviewImg(Path<? extends ReviewImg> path) { ^ symbol: class ReviewImg location: class QReviewImg C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:39: error: cannot find symbol public QReviewImg(PathMetadata metadata) { ^ symbol: class PathMetadata location: class QReviewImg C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:43: error: cannot find symbol public QReviewImg(PathMetadata metadata, PathInits inits) { ^ symbol: class PathMetadata location: class QReviewImg C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:43: error: cannot find symbol public QReviewImg(PathMetadata metadata, PathInits inits) { ^ symbol: class PathInits location: class QReviewImg C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:47: error: cannot find symbol public QReviewImg(Class<? extends ReviewImg> type, PathMetadata metadata, PathInits inits) { ^ symbol: class ReviewImg location: class QReviewImg C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:47: error: cannot find symbol public QReviewImg(Class<? extends ReviewImg> type, PathMetadata metadata, PathInits inits) { ^ symbol: class PathMetadata location: class QReviewImg C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QReviewImg.java:47: error: cannot find symbol public QReviewImg(Class<? extends ReviewImg> type, PathMetadata metadata, PathInits inits) { ^ symbol: class PathInits location: class QReviewImg C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:23: error: cannot find symbol public final StringPath category = createString("category"); ^ symbol: class StringPath location: class QRestaurant C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:25: error: cannot find symbol public final StringPath cell_number = createString("cell_number"); ^ symbol: class StringPath location: class QRestaurant C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:27: error: cannot find symbol public final NumberPath<Integer> id = createNumber("id", Integer.class); ^ symbol: class NumberPath location: class QRestaurant C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:29: error: cannot find symbol public final StringPath load_address = createString("load_address"); ^ symbol: class StringPath location: class QRestaurant C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:31: error: cannot find symbol public final NumberPath<Double> location_x = createNumber("location_x", Double.class); ^ symbol: class NumberPath location: class QRestaurant C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:33: error: cannot find symbol public final NumberPath<Double> location_y = createNumber("location_y", Double.class); ^ symbol: class NumberPath location: class QRestaurant C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:35: error: cannot find symbol public final ListPath<Menu, QMenu> menus = this.<Menu, QMenu>createList("menus", Menu.class, QMenu.class, PathInits.DIRECT2); ^ symbol: class ListPath location: class QRestaurant C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:35: error: cannot find symbol public final ListPath<Menu, QMenu> menus = this.<Menu, QMenu>createList("menus", Menu.class, QMenu.class, PathInits.DIRECT2); ^ symbol: class Menu location: class QRestaurant C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMenu.java:3: error: package com.querydsl.core.types does not exist import static com.querydsl.core.types.PathMetadataFactory.*; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMenu.java:7: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.PathMetadata; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMenu.java:8: error: package javax.annotation does not exist import javax.annotation.Generated; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMenu.java:9: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.Path; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMenu.java:10: error: package com.querydsl.core.types.dsl does not exist import com.querydsl.core.types.dsl.PathInits; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMenu.java:17: error: cannot find symbol public class QMenu extends EntityPathBase<Menu> { ^ symbol: class EntityPathBase C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMenu.java:16: error: cannot find symbol @Generated("com.querydsl.codegen.EntitySerializer") ^ symbol: class Generated C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QMenu.java:17: error: cannot find symbol public class QMenu extends EntityPathBase<Menu> { ^ symbol: class Menu C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:37: error: cannot find symbol public final StringPath name = createString("name"); ^ symbol: class StringPath location: class QRestaurant C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:39: error: cannot find symbol public final ListPath<RecruitBoard, QRecruitBoard> recruitBoards = this.<RecruitBoard, QRecruitBoard>createList("recruitBoards", RecruitBoard.class, QRecruitBoard.class, PathInits.DIRECT2); ^ symbol: class ListPath location: class QRestaurant C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRestaurant.java:39: error: cannot find symbol public final ListPath<RecruitBoard, QRecruitBoard> recruitBoards = this.<RecruitBoard, QRecruitBoard>createList("recruitBoards", RecruitBoard.class, QRecruitBoard.class, PathInits.DIRECT2); ^ symbol: class RecruitBoard location: class QRestaurant C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRecruitBoard.java:3: error: package com.querydsl.core.types does not exist import static com.querydsl.core.types.PathMetadataFactory.*; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRecruitBoard.java:7: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.PathMetadata; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRecruitBoard.java:8: error: package javax.annotation does not exist import javax.annotation.Generated; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRecruitBoard.java:9: error: package com.querydsl.core.types does not exist import com.querydsl.core.types.Path; ^ C:\Users\user\IdeaProjects\intern-project\src\main\generated\com\gabia\project\internproject\common\domain\QRecruitBoard.java:10: error: package com.querydsl.core.types.dsl does not exist import com.querydsl.core.types.dsl.PathInits; ^ 100 errors

답변 10

10

배현규님의 프로필 이미지

2021. 03. 04. 18:43

인텔리 제이 쓰시면 

File | Settings | Build, Execution, Deployment | Build Tools | Gradle 설정에서 

Build and run using: IntelliJ IDEA 로 변경해보셨나요?

audgnssweet님의 프로필 이미지

2021. 08. 13. 20:22

감사합니다 이걸로 해결됐네요

원석나님의 프로필 이미지

2021. 10. 02. 20:03

저도 이걸로 해결됐네요 ㅎㅎ 감사합니다 

8

리다양님의 프로필 이미지

2020. 09. 13. 20:18

안녕하세요~!! 저도 같은 이슈를 겪다가 혹시나 도움이 될까해서 글 남깁니다~!!
저는 Gradle 6.0 이상에서 아래와 같이 설정해서 사용하고 있습니다.

plugins {
    id 'java'
    id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
}

group 'org.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {

    compile group: 'org.hibernate', name: 'hibernate-entitymanager', version: '5.4.21.Final'
    compile group: 'com.h2database', name: 'h2', version: '1.4.200'
    compile 'org.projectlombok:lombok:1.18.12'
    compile group: 'com.querydsl', name: 'querydsl-jpa', version: '4.3.1'

    annotationProcessor 'org.projectlombok:lombok:1.18.12'
    annotationProcessor group: 'com.querydsl', name: 'querydsl-apt', version: '4.3.1'

    testCompileOnly 'org.projectlombok:lombok:1.18.12'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'

    testCompile group: 'junit', name: 'junit', version: '4.12'
}

querydsl {
    jpa = true
    querydslSourcesDir = "$buildDir/generated-source"
}

compileQuerydsl {
    options.annotationProcessorPath = configurations.querydsl
}

이거 설정하고 우선 gradle Fresh 후 gradle -> build -> clean 메뉴 실행 후

gradle -> build -> classes 실행하시거나 프로젝트 런 하시면 쿼리타입(Q붙은 객체) 생성되실거에요~!!

4

손성용님의 프로필 이미지

2020. 03. 20. 23:53

안녕하세요

저도 이 문제에 대해서 되짚어보면서 

프로젝트를 run 하는데는 별 문제 없었는데

빌드를 하려니 오류가 나서 찾아봤습니다

lombok과 querydsl 을 같이 쓰게 되면 생기는 문제더라구요

 id "io.franzbecker.gradle-lombok" version "3.0.0"

구글링 해보면 위 내용을 plugin에 추가하는걸 추천하네요 (저는 아직 해결 못했습니다)

근본적인 문제가 뭔지 궁금합니다 ㅠㅠ 

3

김영한님의 프로필 이미지
김영한
지식공유자

2020. 02. 23. 16:46

최신 intellij를 사용하시면 다음 코드를 참고해주세요^^ 

plugins {
    id 'org.springframework.boot' version ‘2.2.2.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    //querydsl 추가
    id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
    id 'java'
}

group = 'study'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'

    //querydsl 추가
    implementation 'com.querydsl:querydsl-jpa'

    compileOnly 'org.projectlombok:lombok'
    runtimeOnly 'com.h2database:h2'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: ‘org.junit.vintage’, module: ‘junit-vintage-engine'
    }
}

test {
    useJUnitPlatform()
}

//querydsl 추가 시작
def querydslDir = "$buildDir/generated/querydsl"

querydsl {
    jpa = true
    querydslSourcesDir = querydslDir
}
sourceSets {
    main.java.srcDir querydslDir
}
configurations {
    querydsl.extendsFrom compileClasspath
}
compileQuerydsl {
    options.annotationProcessorPath = configurations.querydsl
}
//querydsl 추가 끝

1

mino님의 프로필 이미지

2021. 11. 27. 21:25


//querydsl 추가
def querydslDir = 'src/main/generated'
//def querydslDir = "$buildDir/generated/querydsl"

querydsl {
library = "com.querydsl:querydsl-apt"
jpa = true
querydslSourcesDir = querydslDir
}

sourceSets {
main {
java {
srcDirs = ['src/main/java', querydslDir]
}
}
}

compileQuerydsl{
options.annotationProcessorPath = configurations.querydsl
}

configurations {
querydsl.extendsFrom compileClasspath
}
Whee님의 프로필 이미지

2022. 06. 03. 15:00

감사합니다! 해당 코드로 설정하니 해결 되었습니다 :)
혹시 어떤 의미로 querydslDir가 변경 되었는지 알 수 있을까요?

1

taehee-kim-dev님의 프로필 이미지

2020. 07. 18. 14:30

이거 해결하셨나요? 저도 이것때문에 미치겠네요 ㅠ

0

fears님의 프로필 이미지

2020. 07. 22. 16:27

Jhipster 로 gradle 템플릿 프로젝트 만들어서 dependencies 설정 변경하고 테스트 해보니 잘 되네요.

한번 비교해서 적용해보세요.. 플러그인 설정은 따로 안했습니다. gradle 버전은 6.0 입니다.

dependencies {
// import JHipster dependencies BOM
implementation platform("io.github.jhipster:jhipster-dependencies:${jhipster_dependencies_version}" )

// Use ", version: jhipster_dependencies_version, changing: true" if you want
// to use a SNAPSHOT release instead of a stable release
implementation group: "io.github.jhipster", name: "jhipster-framework"
implementation "org.springframework.boot:spring-boot-starter-cache"
implementation "io.dropwizard.metrics:metrics-core"
implementation "io.micrometer:micrometer-registry-prometheus"
implementation "net.logstash.logback:logstash-logback-encoder"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-hppc"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-hibernate5"
implementation "com.fasterxml.jackson.core:jackson-annotations"
implementation "com.fasterxml.jackson.core:jackson-databind"
implementation "com.fasterxml.jackson.module:jackson-module-afterburner"
implementation "javax.cache:cache-api"
implementation "org.hibernate:hibernate-core"
implementation "com.zaxxer:HikariCP"
implementation "org.apache.commons:commons-lang3"
implementation "commons-io:commons-io"
implementation "javax.transaction:javax.transaction-api"
implementation "org.ehcache:ehcache"
implementation "org.hibernate:hibernate-entitymanager"
implementation "org.hibernate.validator:hibernate-validator"
implementation "org.liquibase:liquibase-core"
liquibaseRuntime "org.liquibase:liquibase-core"
liquibaseRuntime "org.liquibase.ext:liquibase-hibernate5:${liquibase_hibernate5_version}"
liquibaseRuntime sourceSets.main.compileClasspath
implementation "org.springframework.boot:spring-boot-loader-tools"
implementation "org.springframework.boot:spring-boot-starter-mail"
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-aop"
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
implementation "org.apache.kafka:kafka-clients"
implementation "org.springframework.boot:spring-boot-starter-security"
implementation ("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
implementation "org.springframework.boot:spring-boot-starter-undertow"
implementation "org.springframework.boot:spring-boot-starter-websocket"
implementation "org.springframework.boot:spring-boot-starter-thymeleaf"
implementation "org.zalando:problem-spring-web"
implementation "org.springframework.boot:spring-boot-starter-cloud-connectors"
implementation "org.springframework.security:spring-security-config"
implementation "org.springframework.security:spring-security-data"
implementation "org.springframework.security:spring-security-web"
implementation "org.springframework.security:spring-security-messaging"
implementation "io.jsonwebtoken:jjwt-api"
runtimeOnly "io.jsonwebtoken:jjwt-impl"
runtimeOnly "io.jsonwebtoken:jjwt-jackson"
implementation ("io.springfox:springfox-swagger2") {
exclude module: "mapstruct"
}
implementation "io.springfox:springfox-bean-validators"
implementation "org.postgresql:postgresql"
liquibaseRuntime "org.postgresql:postgresql"
implementation "org.mapstruct:mapstruct:${mapstruct_version}"

annotationProcessor "org.glassfish.jaxb:jaxb-runtime:${jaxb_runtime_version}"
annotationProcessor ("org.springframework.boot:spring-boot-configuration-processor:${spring_boot_version}") {
exclude group: "com.vaadin.external.google", module: "android-json"
}
testImplementation "com.jayway.jsonpath:json-path"
testImplementation ("org.springframework.boot:spring-boot-starter-test") {
exclude module: "junit"
exclude group: "com.vaadin.external.google", module: "android-json"
}
testImplementation "org.springframework.security:spring-security-test"
testImplementation "org.springframework.boot:spring-boot-test"
testImplementation "org.junit.jupiter:junit-jupiter-engine"
testImplementation "com.tngtech.archunit:archunit-junit5-api:${archunit_junit5_version}"
testRuntimeOnly "com.tngtech.archunit:archunit-junit5-engine:${archunit_junit5_version}"
testImplementation "org.assertj:assertj-core"
testImplementation "junit:junit"
testImplementation "org.mockito:mockito-core"
testImplementation "org.hamcrest:hamcrest-library"
testImplementation "com.h2database:h2"
testImplementation "org.testcontainers:database-commons"
testImplementation "org.testcontainers:kafka"
//jhipster-needle-gradle-dependency - JHipster will add additional dependencies here


// 여기서 변경 시작!!

// querydsl 적용
compile(
"com.querydsl:querydsl-core:4.3.1",
"com.querydsl:querydsl-jpa:4.3.1"
)

compileOnly "org.projectlombok:lombok:1.18.12"

// annotationProcessor 순서 변경
annotationProcessor "com.querydsl:querydsl-apt:4.3.1:jpa",
"org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final",
"javax.annotation:javax.annotation-api:1.3.2",
"org.projectlombok:lombok:1.18.12",
"org.mapstruct:mapstruct-processor:${mapstruct_version}"
"org.hibernate:hibernate-jpamodelgen:${hibernate_version}"
}

0

Kioni님의 프로필 이미지

2020. 06. 25. 21:47

김영한님께서 위에서 언급하신 코드대로 수정해도 똑같이 안되서 미치겠네요... 실행은 되는것 같으나 프로젝트 빌드가 안되가지고.. 개인프로젝트 Backlog 설정에 여러모로 어려움을 겪고 있습니다..  해결책이 있으면 좋겠네요.

0

cwj님의 프로필 이미지
cwj
질문자

2020. 02. 21. 11:01

아뇨.. 일단 사용은 할 수 있어서 그냥 쓰고있습니다.

0

김영한님의 프로필 이미지
김영한
지식공유자

2020. 02. 04. 00:16

안녕하세요. cwj님

최근 intellij에서 일부 안되는 현상이 있는데요.

전체 프로젝트를 압축해서 올려주세요.

cwj님의 프로필 이미지

작성한 질문수

질문하기