gradle-kotlin-dsl - Gradle 的 Kotlin DSL 脚本无法启动 Quarkus 应用程序
问题描述
我正在(尝试)将 Gradle 脚本(用 Groovy 编写)迁移1.1.0.Final
到 Kotlin DSL 中,但在迁移脚本之后( s),应用程序不再启动。同样,该项目与 Groovy Gradle 脚本一起工作正常,所以我不知道我可能会丢失什么。
这就是我目前在gradle.properties
、settings.gradle.kts
和中所拥有的build.gradle.kts
:
#
# Dependency Versions
kotlin.version = 1.3.61
quarkus.version = 1.1.0.Final
#
# Gradle Settings
org.gradle.configureondemand = false
org.gradle.daemon = false
#
# System Settings
systemProp.file.encoding = UTF-8
systemProp.sun.jnu.encoding = UTF-8
pluginManagement {
repositories {
// mavenLocal() // Uncomment when needed
gradlePluginPortal()
mavenCentral()
maven(url = uri("https://dl.bintray.com/gradle/gradle-plugins/"))
}
plugins {
id("com.commercehub.gradle.plugin.avro").version("0.17.0")
id("eclipse")
id("idea")
id("io.gitlab.arturbosch.detekt").version("1.3.0")
id("io.quarkus").version("1.1.0.Final") // TODO: Read from gradle.properties
id("org.jetbrains.kotlin.jvm").version("1.3.61") // TODO: Read from gradle.properties
id("org.jetbrains.kotlin.plugin.allopen").version("1.3.61") // TODO: Read from gradle.properties
}
}
rootProject.name = "kotlin-quarkus-kafka"
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import io.quarkus.gradle.QuarkusPluginExtension
import io.quarkus.gradle.tasks.QuarkusNative
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.allopen.gradle.AllOpenExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.time.ZoneOffset
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
plugins {
// id("com.commercehub.gradle.plugin.avro")
id("eclipse")
id("idea")
id("io.gitlab.arturbosch.detekt")
id("io.quarkus")
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.kotlin.plugin.allopen")
}
group = "org.acme"
repositories {
// mavenLocal() // Uncomment when needed
jcenter()
}
dependencies {
implementation(enforcedPlatform("io.quarkus:quarkus-bom:${project.property("quarkus.version")}"))
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("io.github.microutils:kotlin-logging:1.5.9")
implementation("io.quarkus:quarkus-config-yaml")
implementation("io.quarkus:quarkus-kotlin")
implementation("io.quarkus:quarkus-resteasy-jackson")
implementation("io.quarkus:quarkus-smallrye-health")
implementation("io.quarkus:quarkus-smallrye-openapi")
implementation("io.quarkus:quarkus-smallrye-reactive-messaging-kafka")
implementation("org.apache.commons:commons-lang3")
implementation("org.jetbrains.kotlin:kotlin-stdlib")
// nativeTestImplementation("io.quarkus:quarkus-junit5")
// nativeTestImplementation("io.rest-assured:rest-assured")
testImplementation("io.quarkus:quarkus-junit5")
testImplementation("io.rest-assured:rest-assured")
testImplementation("org.assertj:assertj-core")
}
//=================================================================================================
// P L U G I N S
//=================================================================================================
configure<AllOpenExtension> {
annotation("io.quarkus.test.junit.QuarkusTest")
annotation("javax.enterprise.context.ApplicationScoped")
annotation("javax.inject.Singleton")
annotation("javax.ws.rs.Path")
}
// configure<DefaultAvroExtension> {
// // TODO: Specify location for schema files
// isCreateSetters = false
// setFieldVisibility(FieldVisibility.PRIVATE)
// }
configure<DetektExtension> {
// ...
}
configure<QuarkusPluginExtension> {
// ...
}
//=================================================================================================
// T A S K S
//=================================================================================================
tasks {
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "${JavaVersion.VERSION_1_8}"
}
}
withType<QuarkusNative> {
// "-H:ReflectionConfigurationFiles=reflection-config.json"
// "-H:ResourceConfigurationFiles=resources-config.json"
additionalBuildArgs = listOf()
}
withType<Test> {
// exclude("**/Native*")
systemProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager")
testLogging {
events = setOf(TestLogEvent.FAILED, TestLogEvent.SKIPPED)
exceptionFormat = TestExceptionFormat.FULL
showCauses = true
showExceptions = true
showStackTraces = true
}
useJUnitPlatform()
}
}
...这是我得到的错误:
[x80486@uplink kotlin-quarkus-kafka]$ ./gradlew clean quarkusDev
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/6.0.1/userguide/gradle_daemon.html.
Daemon will be stopped at the end of the build stopping after processing
> Task :clean
> Task :compileKotlin
> Task :compileJava NO-SOURCE
> Task :processResources
> Task :classes
> Task :quarkusDev FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Some problems were found with the configuration of task ':quarkusDev' (type 'QuarkusDev').
> Directory 'C:\Users\x80486\Workshop\kotlin-quarkus-kafka\build\classes\java\main;C:\Users\x80486\Workshop\kotlin-quarkus-kafka\build\classes\kotlin\main' specified for property 'workingDir' does not exist.
> Directory 'C:\Users\x80486\Workshop\kotlin-quarkus-kafka\src\main\java;C:\Users\x80486\Workshop\kotlin-quarkus-kafka\build\generated-main-avro-java;C:\Users\x80486\Workshop\kotlin-quarkus-kafka\src\main\kotlin' specified for property 'sourceDir' does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 2s
4 actionable tasks: 4 executed
解决方案
推荐阅读
- angular - 当函数返回新值时,如何更新 Angular 中的子组件?
- rust - 处理 rust 中泛型和非泛型类型的枚举返回
- python - 你如何用 Python 正确地从 NVIDIA 网站上抓取数据?
- list - 如何在 Flutter 的 PaginatedDataTable 中使用 DataRows 列表?
- python - Django:如何在 for 循环中正确地进行 bulk_update_or_create()
- jenkins - 如何将 Jenkins 秘密文件传递给 Groovy 脚本?
- vue.js - Vue 测试工具提示的消息
- javascript - 错误:打开 COM:找不到文件 - Nodejs、express、serialPort
- bash - 比较 bash 中以 YYYY-MM-DDTHH:MM:SSZ 格式给出的两次时间
- python-3.x - GitPython A、D、M 变化的最小示例