我正在(尝试)将(在工作中的)Quarkus 1.1.0.Final
概念验证项目中拥有的用Groovy编写的Gradle脚本迁移到Kotlin DSL,但是以某种方式,在迁移脚本之后,该应用程序将无法启动。同样,该项目可以与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
答案 0 :(得分:1)
看起来您遇到的问题与George在这里解决的问题之一非常相似:https://github.com/quarkusio/quarkus/pull/6317。特别是这个提交:https://github.com/quarkusio/quarkus/pull/6317/commits/7b07d866e5b81b46c09d59a08556b9a796c11007。
不能完全确定是否是同一错误。也不完全确定,此修复程序是否适合您的情况。尤其是如果您混合使用Java和Kotlin类。
您能否创建一个简单的复制器并在GitHub上发布问题?然后,我们将能够检查它是否已经解决或需要更多的爱。