Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: YSL-19 QueryDsl 설정 추가 #13

Merged
merged 3 commits into from
Jan 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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<Test> {
useJUnitPlatform()
}

val querydslDir = layout.buildDirectory.dir("generated/querydsl").get().asFile

tasks.withType<JavaCompile> {
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<QuerydslCompile> {
options.annotationProcessorPath = configurations.querydsl.get()
}

// clean 이후에 querydsl 폴더를 지움
tasks.named("clean") {
doLast {
file(querydslDir).deleteRecursively()
}
}