build.gradle
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.4'
id 'io.spring.dependency-management' version '1.1.3'
}
group = 'study'
version = '0.0.1-SNAPSHOT'
java {
sourceCompatibility = '17'
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0'
// Querydsl 추가
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
}
tasks.named('test') {
useJUnitPlatform()
}
/**
* QueryDSL Build Options
*/
def querydslDir = "src/main/generated"
sourceSets {
main.java.srcDirs += [ querydslDir ]
}
tasks.withType(JavaCompile) {
options.getGeneratedSourceOutputDirectory().set(file(querydslDir))
}
clean.doLast {
file(querydslDir).deleteDir()
}
Querydsl build option을 추가하지 않으면
QClass들은 build폴더의 하위레벨에 QClass를 생성은 하지만 사용 시 QClass를 찾지 못해 build options를 추가함
QClass는 src/main/generated에 만들어진다
'Spring' 카테고리의 다른 글
[Spring/ Error] Web server failed to start. Port 8080 was already in use. (0) | 2023.10.12 |
---|---|
[Spring/Error] No serializer found for class (0) | 2023.10.10 |
[IntelliJ/Spring] 단축키 모음 (0) | 2023.08.27 |
[Spring/Error] ids for this class must be manually assigned before calling save(): (0) | 2023.02.01 |
[Spring/Error] Not a managed type: class 명 error (0) | 2023.01.25 |
댓글