Reputation:
I'm in my journey to (try to) migrate the Gradle script(s) –written in Groovy- that I have in a (working) Quarkus 1.1.0.Final
proof-of-concept project into Kotlin DSL, but somehow, after migrating the script(s), the application doesn't start anymore. Again, the project works fine with the Groovy Gradle script(s), so I don't know what I could be missing.
This is what I have so far in gradle.properties
, settings.gradle.kts
, and 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()
}
}
...and this is the error I'm getting:
[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
Upvotes: 0
Views: 981
Reputation: 10539
Looks like you have a very similar issue to one of the issues fixed by George here: https://github.com/quarkusio/quarkus/pull/6317 . Especially this commit: https://github.com/quarkusio/quarkus/pull/6317/commits/7b07d866e5b81b46c09d59a08556b9a796c11007 .
Not entirely sure it's the same bug though. And not totally sure, the fix will be right in your case. Especially if you have a mix of Java and Kotlin classes.
Could you create a simple reproducer and open an issue on GitHub? We will then be able to check if it's already solved or needs some more love.
Upvotes: 0