Skip to content

Commit

Permalink
feature: [#109] querydsl 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
HanKwanJin committed Mar 3, 2023
1 parent 9f9b1a8 commit d93d6ee
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions be/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ build/
!**/src/main/**/build/
!**/src/test/**/build/

### Querydsl
src/main/generated

### STS ###
.apt_generated
.classpath
Expand Down
24 changes: 24 additions & 0 deletions be/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ dependencies {
implementation 'io.awspring.cloud:spring-cloud-starter-aws:2.4.2'
implementation 'com.amazonaws:aws-java-sdk-s3'
testImplementation 'io.findify:s3mock_2.13:0.2.6'

// 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) 대응 코드
}

tasks.named('test') {
Expand All @@ -85,4 +93,20 @@ task copyGitSubmodule(type: Copy) {
include 'db/**'
}

// Querydsl 설정부
def generated = 'src/main/generated'

// querydsl QClass 파일 생성 위치를 지정
tasks.withType(JavaCompile) {
options.getGeneratedSourceOutputDirectory().set(file(generated))
}

// java source set 에 querydsl QClass 위치 추가
sourceSets {
main.java.srcDirs += [ generated ]
}

// gradle clean 시에 QClass 디렉토리 삭제
clean {
delete file(generated)
}

0 comments on commit d93d6ee

Please sign in to comment.