Это мой код, основанный на гильдии быстрого запуска ktor.io (https://ktor.io/quickstart/quickstart/gradle.html)
package blog
import io.ktor.application.*
import io.ktor.http.*
import io.ktor.response.*
import io.ktor.routing.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import org.jetbrains.ktor.features.CallLogging
fun Application.main() {
install(DefaultHeaders)
install(CallLogging)
install(Routing) {
get("/") {
call.respondText("My Example Blog2", ContentType.Text.Html)
}
}
}
Когда я запускаю gradle build
, я получаю следующие ошибки:
e: /Users/antkong/dev/poc/kotlin/src/main/kotlin/BlogApp.kt: (10, 22): неразрешенная ссылка: ktor
e: / Пользователи / antkong / dev / poc / kotlin / src / main / kotlin / BlogApp.kt: (14, 13): неразрешенная ссылка: DefaultHeaders e:
e: / Users / antkong / dev / poc / kotlin /src/main/kotlin/BlogApp.kt: (15, 13): неразрешенная ссылка: CallLogging
Вот мой файл build.gradle
group 'Example'
buildscript {
ext.kotlin_version = '1.3.61'
ext.ktor_version = '1.3.0'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'application'
mainClassName = 'io.ktor.server.netty.EngineMain'
sourceCompatibility = 1.8
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
kotlin {
}
repositories {
jcenter()
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "io.ktor:ktor-server-netty:$ktor_version"
compile "ch.qos.logback:logback-classic:1.2.3"
testCompile group: 'junit', name: 'junit', version: '4.12'
}
Как я могу исправить эти ошибки?