스프링부트 2.7 이상 QueryDsl build.gradle 설정 방법

박재민·2022년 11월 26일
0
post-custom-banner

buildscript {
  ext {
      queryDslVersion = "5.0.0"
  }
}


plugins {
  id 'org.springframework.boot' version '2.7.5'
  id 'io.spring.dependency-management' version '1.0.15.RELEASE'
  id 'java'
  id 'war'
  id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10'
}


apply plugin: 'com.ewerk.gradle.plugins.querydsl'
group = 'toy.tiering'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {

    implementation "com.querydsl:querydsl-jpa:${queryDslVersion}"

    implementation "com.querydsl:querydsl-apt:${queryDslVersion}"

}

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

def querydslDir = "$buildDir/generated/querydsl"

querydsl {
    jpa = true
    querydslSourcesDir = querydslDir
}
sourceSets {
    main.java.srcDir querydslDir
}
configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
    querydsl.extendsFrom compileClasspath
}
compileQuerydsl {
    options.annotationProcessorPath = configurations.querydsl
}

compileQuerydsl.doFirst {
    if(file(querydslDir).exists() )
        delete(file(querydslDir))
}
profile
동료를 소중히 생각하는 개발자입니다.
post-custom-banner

0개의 댓글