Sebastien Leclerc Lavallee
03/05/2022, 5:31 AMplugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
}
version = "1.0.0"
java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8
kotlin {
js(IR) {
browser()
}
jvm()
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
implementation(Deps.kotlinxSerialization)
}
}
val commonTest by getting {
dependencies {
api("org.jetbrains.kotlin:kotlin-test")
}
}
val jvmMain by getting
val jvmTest by getting
val jsMain by getting
val jsTest by getting
}
}
And now I did add this new ktor module
plugins {
kotlin("jvm")
kotlin("plugin.serialization")
id("application")
}
version = "1.0.0"
java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8
dependencies {
implementation(kotlin("stdlib"))
implementation(project(":core"))
implementation("io.ktor:ktor-server-core:1.6.1")
implementation("io.ktor:ktor-server-netty:1.6.1")
implementation("io.ktor:ktor-serialization:1.6.1")
implementation("ch.qos.logback:logback-classic:1.2.6")
}
application {
mainClass.set("ca.sebleclerc.api.ApplicationKt")
}
When I execute ./gradlew server:run
I get this error:
* What went wrong:
Could not determine the dependencies of task ':server:run'.
> Could not resolve all task dependencies for configuration ':server:runtimeClasspath'.
> Could not resolve project :core.
Required by:
project :server
> The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'. However we cannot choose between the following variants of project :core:
- jvmRuntimeElements
- ktlint
All of them match the consumer attributes:
- Variant 'jvmRuntimeElements' capability core:1.0.0 declares a runtime of a library, packaged as a jar, preferably optimized for standard JVMs, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Unmatched attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
[... and so on]
I understand it can’t match anything that is produced by my core module but I can’t find anything to make it work. I did tried a few things but nothing worked… Anybody have any clue? Hint?
I am using Kotlin 1.6.20-M1
Thanks for the help 🙂Sebastian Sellmair [JB]
03/05/2022, 8:44 AMSebastien Leclerc Lavallee
03/05/2022, 2:11 PMSebastian Sellmair [JB]
03/06/2022, 1:45 PMSebastian Sellmair [JB]
03/06/2022, 1:45 PMSebastian Sellmair [JB]
03/06/2022, 1:46 PMSebastien Leclerc Lavallee
03/06/2022, 2:10 PMisCanBeConsumed
Sebastian Sellmair [JB]
03/06/2022, 4:00 PMallprojects {
configurations.matching { it.name == "ktlint" }.configureEach {
isCanBeConsumed = false
}
}
Note: this is just written from the back of my mind, not tested in any way.
If this does not work, or has any unintended side effects for you, then we could jump into a Google meet call to look into the problem, if you like! ☺️Sebastien Leclerc Lavallee
03/07/2022, 5:02 AMPaul Woitaschek
04/11/2022, 6:01 PMPaul Woitaschek
04/11/2022, 6:01 PMSebastien Leclerc Lavallee
04/11/2022, 6:04 PMSebastien Leclerc Lavallee
04/11/2022, 6:05 PMPaul Woitaschek
04/11/2022, 6:15 PMSebastien Leclerc Lavallee
04/11/2022, 6:16 PMPaul Woitaschek
04/11/2022, 8:45 PM