代码拉取完成,页面将自动刷新
plugins {
id("org.jetbrains.kotlin.jvm") version "1.9.25"
id("org.jetbrains.kotlin.plugin.allopen") version "1.9.25"
id("com.google.devtools.ksp") version "1.9.25-1.0.20"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("io.micronaut.application") version "4.4.2"
id("io.micronaut.test-resources") version "4.4.2"
id("io.micronaut.aot") version "4.4.2"
// 生成jooq代码插件
id("nu.studer.jooq") version "9.0"
}
version = "0.1"
group = "com.ewancle"
val kotlinVersion=project.properties.get("kotlinVersion")
repositories {
mavenCentral()
}
dependencies {
ksp("io.micronaut:micronaut-http-validation")
ksp("io.micronaut.serde:micronaut-serde-processor")
implementation("io.micronaut.kotlin:micronaut-kotlin-runtime")
implementation("io.micronaut.serde:micronaut-serde-jackson")
implementation("io.micronaut.sql:micronaut-jdbc-hikari")
implementation("io.micronaut.sql:micronaut-jooq")
implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
compileOnly("io.micronaut:micronaut-http-client")
runtimeOnly("ch.qos.logback:logback-classic")
runtimeOnly("com.fasterxml.jackson.module:jackson-module-kotlin")
runtimeOnly("org.postgresql:postgresql")
testImplementation("io.micronaut:micronaut-http-client")
jooqGenerator("org.postgresql:postgresql:42.3.1") // 生成代码PostgreSQL 数据库驱动
// 响应式
implementation("io.micrometer:context-propagation")
implementation("io.micronaut.reactor:micronaut-reactor")
// 协程支持
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.9.0")
implementation("org.jooq:jooq-kotlin:3.19.11") // JOOQ Kotlin 支持
implementation("org.jooq:jooq-meta:3.19.11") // jooq-meta 支持
implementation("org.jooq:jooq-codegen:3.19.11") // jooq-meta 支持
}
application {
mainClass = "com.ewancle.ApplicationKt"
}
java {
sourceCompatibility = JavaVersion.toVersion("21")
}
graalvmNative.toolchainDetection = false
micronaut {
runtime("netty")
testRuntime("kotest5")
processing {
incremental(true)
annotations("com.ewancle.*")
}
testResources {
additionalModules.add("jdbc-postgresql")
}
aot {
// Please review carefully the optimizations enabled below
// Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details
optimizeServiceLoading = false
convertYamlToJava = false
precomputeOperations = true
cacheEnvironment = true
optimizeClassLoading = true
deduceEnvironment = true
optimizeNetty = true
replaceLogbackXml = true
}
}
tasks.named<io.micronaut.gradle.docker.NativeImageDockerfile>("dockerfileNative") {
jdkVersion = "21"
}
tasks.named("dockerBuild").configure {
enabled = false
}
tasks.named("dockerPush").configure {
enabled = false
}
// 执行生成在build就能被使用: .\gradlew.bat generateJooq
jooq {
version.set("3.19.11")
edition.set(nu.studer.gradle.jooq.JooqEdition.OSS)
configurations {
create("main") {
generateSchemaSourceOnCompilation.set(true)
jooqConfiguration.apply {
logging = org.jooq.meta.jaxb.Logging.WARN
jdbc.apply {
url = "jdbc:postgresql://129.159.47.69:19359/study"
user = "postgres"
password = "Xiehaijun945"
driver = "org.postgresql.Driver"
}
generator.apply {
name = "org.jooq.codegen.KotlinGenerator" // 生成 Kotlin 代码
strategy.name = "org.jooq.codegen.DefaultGeneratorStrategy"
database.apply {
name = "org.jooq.meta.postgres.PostgresDatabase"
inputSchema = "public" // 你的 schema 名称
// 仅生成指定表的代码
includes = "fruit"
//includes = "users|orders" // 使用正则表达式指定表名,生成 `users` 和 `orders` 表的代码
//excludes = ".*_history" // 可以使用 excludes 来排除表("user_.*")
}
generate.apply {
isDeprecated = false
isRecords = true
isImmutablePojos = true
isFluentSetters = true
}
target.apply {
packageName = "com.ewancle.tables" // 生成代码的包名
directory = "build/generated-src/jooqTables" // 代码生成目录(不放src目录,每次打包前生成)
}
}
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。