Reputation: 51
Error:(11, 40) Kotlin: Cannot access built-in declaration 'kotlin.coroutines.SuspendFunction1'. Ensure that you have a dependency on the Kotlin standard library
fun Route.coroutineHandler(fn: suspend (RoutingContext) -> Unit) {
handler { ctx ->
launch(ctx.vertx().dispatcher()) {
try {
fn(ctx)
} catch (e: Exception) {
ctx.fail(e)
}
}
}
Upvotes: 5
Views: 12543
Reputation: 486
Like Slaw commented just add the kotlinx-coroutines-core
dependency to your project as described in the README
Add dependencies (you can also add other modules that you need):
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core</artifactId>
<version>1.3.5</version>
</dependency>
And make sure that you use the latest Kotlin version:
<properties>
<kotlin.version>1.3.70</kotlin.version>
</properties>
Add dependencies (you can also add other modules that you need):
dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5'
}
And make sure that you use the latest Kotlin version:
buildscript {
ext.kotlin_version = '1.3.70'
}
Make sure that you have either jcenter()
or mavenCentral()
in the list of repositories:
repository {
jcenter()
}
Upvotes: 2