gpt4 book ai didi

gradle - 使用Gradle Kotlin DSL配置Jooq时如何修复 'Unresolved reference: jdbc'

转载 作者:行者123 更新时间:2023-12-02 13:34:52 24 4
gpt4 key购买 nike

当我尝试使用gradle jooq插件(https://github.com/etiennestuder/gradle-jooq-plugin)配置jdbc驱动程序以使用Jooq生成代码时,IntelliJ IDEA 2019.2.4(Ultimate Edition)引发Unresolved reference: jdbc
我已遵循此处记录的配置步骤:https://github.com/etiennestuder/gradle-jooq-plugin#configuration

我的build.gradle.kts的内容:(当jdbc块被注释掉时编译)

import nu.studer.gradle.jooq.JooqEdition

plugins {
kotlin("jvm")
id("nu.studer.jooq") version "3.0.3" apply true
id("java-library")
}

dependencies {
compile(kotlin("stdlib"))
compile("org.postgresql:postgresql:42.2.7")
compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2")
compile("org.slf4j:slf4j-api:1.7.28")
compile("ch.qos.logback:logback-classic:1.2.3")
compile("ch.qos.logback:logback-core:1.2.3")
compile("org.jooq:jooq")
jooqRuntime("postgresql:postgresql:9.1-901.jdbc")

}

jooq {
version = "3.11.11"
edition = JooqEdition.OSS
jdbc {
driver = "org.postgresql.Driver"
url = "jdbc:postgresql://localhost:5432/postgres"
user = "postgres"
password = "postgres"
}
}

导入更改时,Gradle返回的错误为:
core/build.gradle.kts
Unresolved reference: jdbc
Unresolved reference: driver
Unresolved reference: url
Unresolved reference: user
Unresolved reference: password

最佳答案

如所使用的third-party plugin's readme中所述,已将jOOQ配置元素放在错误的级别。自述文件中给出的示例如下:

jooq {
version = '3.11.11'
edition = 'OSS'
sample(sourceSets.main) { // This is relevant here
jdbc {
driver = 'org.postgresql.Driver'
url = 'jdbc:postgresql://localhost:5432/sample'
...
}
...
}
}

关于gradle - 使用Gradle Kotlin DSL配置Jooq时如何修复 'Unresolved reference: jdbc',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58622940/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com