From ddc66f051bbe46112b65fc424012b106bdce16f5 Mon Sep 17 00:00:00 2001 From: Zinzo <42106799+zinzoddari@users.noreply.github.com> Date: Sun, 7 Jan 2024 23:55:35 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20YSL-19=20QueryDsl=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20(#13)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: QueryDsl 설정 추가 * refactor: 마지막 라인 추가 * fix: Query DSL Build 실패 수정 (#14) --------- Co-authored-by: beng9re --- build.gradle.kts | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index a48692c..ece0c84 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,10 @@ +import com.ewerk.gradle.plugins.tasks.QuerydslCompile + plugins { java id("org.springframework.boot") version "2.7.8" id("io.spring.dependency-management") version "1.1.4" + id("com.ewerk.gradle.plugins.querydsl") version "1.0.10" } group = "com.example" @@ -46,8 +49,46 @@ dependencies { //test testImplementation("org.springframework.boot:spring-boot-starter-test") + + //querydsl + implementation("com.querydsl:querydsl-jpa") + implementation ("com.querydsl:querydsl-core") + implementation ("com.querydsl:querydsl-collections") + annotationProcessor ("com.querydsl:querydsl-apt:5.0.0") } tasks.withType { useJUnitPlatform() } + +val querydslDir = layout.buildDirectory.dir("generated/querydsl").get().asFile + +tasks.withType { + options.generatedSourceOutputDirectory.set(file(querydslDir)) +} + +querydsl { + jpa = true + querydslSourcesDir = querydslDir.name +} + +sourceSets.getByName("main") { + java.srcDir(querydslDir) +} + +configurations { + named("querydsl") { + extendsFrom(configurations.compileClasspath.get()) + } +} + +tasks.withType { + options.annotationProcessorPath = configurations.querydsl.get() +} + +// clean 이후에 querydsl 폴더를 지움 +tasks.named("clean") { + doLast { + file(querydslDir).deleteRecursively() + } +}