강의

멘토링

커뮤니티

Inflearn Community Q&A

chhong9965's profile image
chhong9965

asked

jOOQ in action! Type Safe SQL with Java

(Practice) Creating a jOOQ Project

build.gradle.kts

Resolved

Written on

·

740

·

Edited

3

plugins {
    id("org.springframework.boot") version "3.3.0"
    id("io.spring.dependency-management") version "1.1.5"
    kotlin("jvm") version "1.9.24"
    kotlin("plugin.spring") version "1.9.24"
    id("nu.studer.jooq") version "9.0"
}

group = "com.sight"
version = "0.0.1-SNAPSHOT"

java {
    toolchain {
       languageVersion = JavaLanguageVersion.of(17)
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-jooq")
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    runtimeOnly("com.mysql:mysql-connector-j")
    testImplementation("org.springframework.boot:spring-boot-starter-test")
    testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
    testRuntimeOnly("org.junit.platform:junit-platform-launcher")

    jooqGenerator("com.mysql:mysql-connector-j")
    jooqGenerator("org.jooq:jooq")
    jooqGenerator("org.jooq:jooq-meta")
}

kotlin {
    compilerOptions {
       freeCompilerArgs.addAll("-Xjsr305=strict")
    }
}

tasks.withType<Test> {
    useJUnitPlatform()
}

val dbUser: String = System.getProperty("db-user") ?: "root"
val dbPassword: String = System.getProperty("db-passwd") ?: "passwd"

jooq {
    configurations {
       create("sakilaDB") {
          generateSchemaSourceOnCompilation.set(false) // 기본적으로 스키마 소스 생성을 비활성화합니다.

          jooqConfiguration.apply {
             jdbc.apply {
                driver = "com.mysql.cj.jdbc.Driver"
                url = "jdbc:mysql://localhost:3306/sakila"
                user = dbUser
                password = dbPassword
             }
             generator.apply {
                name = "org.jooq.codegen.KotlinGenerator" // 코틀린 제너레이터 명시
                database.apply {
                   name = "org.jooq.meta.mysql.MySQLDatabase"
                   inputSchema = "sakila"
                }
                generate.apply {
                   isDaos = true
                   isRecords = true
                   isFluentSetters = true
                   isJavaTimeTypes = true
                   isDeprecated = false
                }
                target.apply {
                   directory = "src/generated"
                }
             }
          }
       }
    }
}

sourceSets {
    main {
       kotlin {
          srcDirs(listOf("src/main/kotlin", "src/generated"))
       }
    }
}

 3.3.0 버전은 jooq 최신버전을 사용하고 있는 것 같아서 group 재설정은 뺐습니다.

javasqlspring-bootjooqdsl

Answer 2

1

sdm32851630님의 프로필 이미지
sdm32851630
Instructor

chhong님 안녕하세요.

맞습니다 ㅎㅎ 강의를 촬영 할 시점에는  3.3.0 버전이 나오지 않아 부득이하게

spring-boot-starter-jooq에서 강제로 의존성을 제거하고 jOOQ 3.19.5 버전을 추가했었는데요.

(spring boot 3.2.3 버전에서는 기본 설정이 jOOQ 3.18.11 이였음)

 

spring boot 3.3.0에서는 jOOQ 3.19.8이 기본으로 들어가서 group 재설정은 하실 필요가 없습니다.

 

해당 질문은 완료처리 하도록 하겠습니다.

공유해주셔서 감사합니다 🙂

0

오 코틀린 설정! 감사요

chhong9965's profile image
chhong9965

asked

Ask a question