https://kotlinlang.org logo
a

Abhishek Bansal

03/19/2021, 6:41 PM
Hello I have been trying to compile a simple
hello world
Ktor
app with kotless plugin and Kotlin gradle DSL but keep hitting following error at gradle sync step
Copy code
> Failed to notify project evaluation listener.
   > Could not initialize class io.kotless.parser.KotlessDescriptor
Here is gradle script that I have written
Copy code
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import io.kotless.plugin.gradle.dsl.kotless
import io.kotless.resource.Lambda.Config.*

plugins {
    kotlin("jvm") version "1.4.21"
    id ("tanvd.kosogor") version "1.0.10"
    id("io.kotless") version "0.1.7-beta-5" apply true
}

buildscript {
    repositories {
        mavenCentral()
        gradlePluginPortal()
        jcenter()
    }

    dependencies {
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21")
        classpath("io.kotless:gradle:0.1.7-beta-5")
    }
}

tasks.withType<KotlinCompile> {
    kotlinOptions {
        jvmTarget = "1.8"
        languageVersion = "1.4"
        apiVersion = "1.4"
    }
}

repositories {
    mavenCentral()
    gradlePluginPortal()
    jcenter()
}

group = "dev.abhishekbansal"
version = "1.0"


dependencies {
    implementation("io.kotless", "ktor-lang", "0.1.7-beta-5")
}
Here is link to full project https://github.com/abhishekBansal/hello-world-ktor-aws-lambda Any pointers here?
t

TanVD

03/20/2021, 9:54 AM
Why do you use plugins and buildscript at the same time? 🙂
a

Abhishek Bansal

03/20/2021, 9:57 AM
I am not sure if I follow. This is also my first time with Kotlin gradle DSL. In groovy world
buildscript
was used to find plugins I believe.
If I comment out
buildscript
block hereis what I get in sync step
Copy code
> Failed to notify project evaluation listener.
   > kotlin/KotlinNothingValueException
And interestingly when I try syncing again I get same
Could not initialize class io.kotless.parser.KotlessDescriptor
error
Removed
buildscript
, added
buildSrc/build.gradle.kts
removed
tanvd.kosogor
plugin and tried other n number of combinations but no luck.
It was gradle version that was creating trouble. Its mentioned in the doc and I missed it. 😕 Thanks for your help!
👍 1
5 Views