개발환경
Java8
Springboot 2.7.4
Gradle 6.8.3
/** queryDsl **/
buildscript{
ext{
queryDslVersion = "5.0.0"
}
}
/** //queryDsl **/
plugins {
id 'org.springframework.boot' version '2.7.4'
id 'io.spring.dependency-management' version '1.0.14.RELEASE'
id 'java'
/** queryDsl **/
id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
/** //queryDsl **/
}
...
/** queryDsl **/
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
/** //queryDsl **/
repositories {
mavenCentral()
}
dependencies {
...
/** queryDsl **/
implementation "com.querydsl:querydsl-jpa:${queryDslVersion}"
implementation "com.querydsl:querydsl-apt:${queryDslVersion}"
/** //queryDsl **/
...
}
/** queryDsl **/
def querydslDir = "$buildDir/generated/querydsl"
querydsl{
jpa = true
querydslSourcesDir = querydslDir
}
//build시 사용할 sourceSet 추가
sourceSets {
main.java.srcDir querydslDir
}
//querydsl 컴파일시 사용할 옵션 설정
compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl
}
//querydsl이 compileClassPath를 상속하도록 설정
configurations {
querydsl.extendsFrom compileClasspath
}
/** //queryDsl **/
...