前提・実現したいこと
KtorでHello world
上記の通り、KtorでHello worldをしたいと思い、公式のクイックスタートやQiitaなどを見て実行してみたのですが、エラーを吐かれてしまい、どのように対処すれば良いのか悩んでいます。
よろしければ皆様のお力をお貸しいただけないでしょうか…
発生している問題・エラーメッセージ
該当のソースコード
Kotlin
1//Application.Kt 2package main.box 3 4import io.ktor.application.call 5import io.ktor.http.ContentType 6import io.ktor.response.respondText 7import io.ktor.routing.get 8import io.ktor.routing.routing 9import io.ktor.server.engine.embeddedServer 10import io.ktor.server.netty.Netty 11 12 13fun main(args: Array<String>) { 14 embeddedServer(Netty, 8080) { 15 routing { 16 get("/") { 17 call.respondText("Hello, world!", ContentType.Text.Html) 18 } 19 } 20 }.start(wait = true) 21}
build.gradle
gradle
1group 'main.ensemblebox' 2version '1.0-SNAPSHOT' 3 4buildscript { 5 ext.kotlin_version = '1.3.0-rc-131' 6 ext.ktor_version = '1.0.0-beta-1' 7 8 repositories { 9 mavenCentral() 10 maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } 11 } 12 dependencies { 13 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 } 15} 16 17apply plugin: 'java' 18apply plugin: 'kotlin' 19apply plugin: 'application' 20 21mainClassName = 'ApplicationKt' 22 23sourceCompatibility = 1.8 24compileKotlin { kotlinOptions.jvmTarget = "1.8" } 25compileTestKotlin { kotlinOptions.jvmTarget = "1.8" } 26 27kotlin { experimental { coroutines "enable" } } 28 29repositories { 30 mavenCentral() 31 jcenter() 32 maven { url "https://dl.bintray.com/kotlin/kotlin-eap" } 33 maven { url "https://dl.bintray.com/kotlin/kotlinx" } 34 maven { url "https://dl.bintray.com/kotlin/ktor" } 35} 36 37dependencies { 38 compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" 39// https://mvnrepository.com/artifact/io.ktor/ktor-server-netty 40 compile group: 'io.ktor', name: 'ktor-server-netty', version: '1.0.0-beta-2' 41 42 compile "ch.qos.logback:logback-classic:1.2.3" 43 44 45 46 testCompile group: 'junit', name: 'junit', version: '4.12' 47}
補足情報(FW/ツールのバージョンなど)
Intellij IDEA communication Edition 2018
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。