2023-05-28
1. 방법
주석으로 //QueryDSL이라고 적혀 있는 부분만 추가해서 넣어주면 된다. 두 줄 이상 연속 된 부분은 //QueryDSL START 와 //QueryDSL END라고 적혀 있다.
buildscript {
ext{
kotlin_version = '1.8.20-Beta'
queryDslVersion = "5.0.0" // QueryDSL
}
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
}
}
plugins {
id 'org.springframework.boot' version '2.7.3'
id 'io.spring.dependency-management' version '1.0.13.RELEASE'
id 'java'
//QueryDSL
id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
id 'org.springframework.experimental.aot' version '0.12.1'
}
group = 'com.source'
version = '0.0.1-SNAPSHOT'
apply plugin: 'war'
apply plugin: 'kotlin'
apply plugin: "kotlin-allopen"
sourceCompatibility = '17'
allOpen {
annotation("org.springframework.stereotype.Controller")
annotation("org.springframework.stereotype.Service")
annotation("org.springframework.stereotype.Repository")
annotation("org.springframework.boot.autoconfigure.SpringBootApplication")
annotation("org.springframework.context.annotation.Configuration")
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
maven { url 'https://repo.spring.io/release' }
mavenCentral()
}
dependencies {
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper'
implementation 'javax.servlet:jstl:1.2'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-configuration-processor
implementation group: 'org.springframework.boot', name: 'spring-boot-configuration-processor', version: '3.0.3'
// QueryDSL START
implementation "com.querydsl:querydsl-jpa:${queryDslVersion}"
implementation "com.querydsl:querydsl-apt:${queryDslVersion}"
implementation "com.querydsl:querydsl-core:${queryDslVersion}"
// QueryDSL END
implementation 'io.github.oshai:kotlin-logging-jvm:4.0.0-beta-11'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '2.7.8'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa
// implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '3.1.0'
// https://mvnrepository.com/artifact/org.postgresql/postgresql
implementation group: 'org.postgresql', name: 'postgresql', version: '42.5.3'
// https://mvnrepository.com/artifact/org.springframework/spring-jdbc
implementation group: 'org.springframework', name: 'spring-jdbc', version: '5.3.23'
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation @NotBlank @Email
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: '2.7.4'
// https://mvnrepository.com/artifact/nz.net.ultraq.thymeleaf/thymeleaf-layout-dialect
implementation group: 'nz.net.ultraq.thymeleaf', name: 'thymeleaf-layout-dialect', version: '3.1.0'
// https://mvnrepository.com/artifact/javainetlocator/inetaddresslocator
implementation group: 'javainetlocator', name: 'inetaddresslocator', version: '2.18'
// https://mvnrepository.com/artifact/org.apache.commons/commons-text
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.10.0'
// https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
//jwt
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
// https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-impl
implementation group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
// https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-jackson
implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'
// https://mvnrepository.com/artifact/commons-io/commons-io
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
// https://mvnrepository.com/artifact/org.json/json
implementation group: 'org.json', name: 'json', version: '20220924'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.14.2'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.14.2'
// https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
testImplementation 'org.springframework.security:spring-security-test'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
tasks.named('test') {
useJUnitPlatform()
}
//QueryDSL START
def querydslDir = "$buildDir/generated/querydsl"
querydsl {
jpa = true
querydslSourcesDir = querydslDir
}
sourceSets {
main.java.srcDir querydslDir
}
compileQuerydsl{
options.annotationProcessorPath = configurations.querydsl
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
querydsl.extendsFrom compileClasspath
}
//QueryDSL END
tasks.named('bootBuildImage') {
builder = 'paketobuildpacks/builder:tiny'
environment = ['BP_NATIVE_IMAGE': 'true']
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
메인 이미지 출처 : 사진: Unsplash의Annie Spratt