I'm trying create my first code Kotlin using Ktor....
# ktor
a
I'm trying create my first code Kotlin using Ktor. I installed Jetty, and works ok. I useing this exemplo to create my first test: https://github.com/ktorio/ktor-samples/tree/master/deployment/jetty-war But when run gradlew I have ths error message:
Copy code
./gradlew :teste:run

FAILURE: Build failed with an exception.

* What went wrong:
Project 'teste' not found in root project 'teste'.

* 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 0s
This is my gradle file:
Copy code
buildscript {
    ext.gretty_version = '2.0.0'
    ext.kotlin_version = '1.3.11'
    ext.ktor_version = '1.0.1'

    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.akhikhl.gretty:gretty:$gretty_version"
    }
}

plugins {
    id 'java'
    id 'org.jetbrains.intellij' version '0.3.12'
    id 'org.jetbrains.kotlin.jvm' version '1.3.0'
}

apply plugin: 'kotlin'
apply plugin: 'war'
apply plugin: 'org.akhikhl.gretty'


webAppDirName = 'webapp'

gretty {
    contextPath = '/'
    logbackConfigFile = 'resources/logback.xml'
}

sourceSets {
    main.kotlin.srcDirs = [ 'src' ]
    main.resources.srcDirs = [ 'resources' ]
}

repositories {
    jcenter()
    maven { url "<https://kotlin.bintray.com/ktor>" }
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    compile "io.ktor:ktor-server-servlet:$ktor_version"
    compile "io.ktor:ktor-html-builder:$ktor_version"
    compile "ch.qos.logback:logback-classic:1.2.3"
}

kotlin.experimental.coroutines = 'enable'

task run

afterEvaluate {
    run.dependsOn(tasks.findByName("appRun"))
}
where i'm worong?
l
Does
./gradlew run
works?
To run
./gradlew :teste:run
you need to have the source code in a Gradle subproject called
teste
, which is not the case in the sample
jetty-war
. Also it's not necessary to install Jetty manually for this sample, because Ktor will use an embedded version of it.
a
Helo Lucas, I installed jetty, because, I'm run the web app without ide, I will run only call on browser. I run ./gradlew run and works, but I received errors. I will debug and back here