Skip to content

Commit

Permalink
[#286] chore(build.gradle): QueryDSL 의존성 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hoonyworld committed Dec 5, 2024
1 parent 71eaf33 commit 1d6e0c0
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ configurations {
compileOnly {
extendsFrom annotationProcessor
}

// Configure libraries related to QueryDSL to be required only at compile-time and add QueryDSL configuration to the compile classpath.
querydsl.extendsFrom compileClasspath
}

repositories {
Expand All @@ -25,6 +28,11 @@ repositories {
maven { url "https://repo.spring.io/snapshot" }
}

// Set global variables used in the project
ext {
set('queryDslVersion', "5.0.0")
}

dependencies {
// Spring
implementation 'org.springframework.boot:spring-boot-starter-web'
Expand Down Expand Up @@ -74,9 +82,15 @@ dependencies {
implementation 'io.awspring.cloud:spring-cloud-starter-aws:2.4.4'
implementation 'io.awspring.cloud:spring-cloud-starter-aws-secrets-manager-config:2.4.4'

//coolsms
// coolsms
implementation 'net.nurigo:sdk:4.3.0'
implementation 'net.nurigo:javaSDK:2.2'

// QueryDSL
implementation "com.querydsl:querydsl-jpa:${queryDslVersion}:jakarta"
annotationProcessor "com.querydsl:querydsl-apt:${queryDslVersion}:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
}

jar {
Expand All @@ -85,4 +99,23 @@ jar {

tasks.named('test') {
useJUnitPlatform()
}
}

// Set the directory path where the Q-Class will be generated.
def queryDslSrcDir = 'src/main/generated/querydsl/'

// When executing the JavaCompile task, set the output directory for the generated source code to queryDslSrcDir
tasks.withType(JavaCompile).configureEach {
options.getGeneratedSourceOutputDirectory().set(file(queryDslSrcDir))
}

// Add the Q-Class files to the directory path recognized as source code.
// This ensures that the Q-Class is treated as a regular Java class and included in the classpath during compilation and execution.
sourceSets {
main.java.srcDirs += [queryDslSrcDir]
}

// Configure the clean task to delete the specified directory, automatically removing the generated Q-Class.
clean {
delete file(queryDslSrcDir)
}

0 comments on commit 1d6e0c0

Please sign in to comment.