My problem is that whenever I open the project lot...
# server
y
My problem is that whenever I open the project lots of code is red and I get "Error: Could not find or load main class dev.yasan.wallpapers.ApplicationKt Caused by: java.lang.ClassNotFoundException: dev.yasan.wallpapers.ApplicationKt" Error. I have not found a proper fix yet. I just have to rebuild the project like 10+ times and it gets fixed randomly. How do I fix this? its really annoying
e
It may be an issue with compile/runtime dependencies. Can you paste your build file here?
y
Looks like it since usually deleting the build folder & reopening it fixes the issue. my build file? Should I just zip the build folder and send it? or?
Also it looks like deleting the build folder from IDEA itself wont help. I have to reopen IDEA + Delete build folder to make it fix the issue.
e
Just paste your
build.gradle
or
pom.xml
here
d
Have you tried removing the project and the adding it again? Definitely sounds like a version mismatch somewhere.
y
@edrd
Copy code
import org.jetbrains.kotlin.gradle.dsl.Coroutines
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project

plugins {
    application
    kotlin("jvm") version "1.4.30"
}

group = "dev.yasan.wallpapers"
version = "0.0.1"
application {
    mainClass.set("io.ktor.server.netty.EngineMain")
}

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

val exposedVersion: String by project
dependencies {
    implementation("io.ktor:ktor-server-netty:$ktor_version")
    implementation("ch.qos.logback:logback-classic:$logback_version")
    implementation("io.ktor:ktor-server-core:$ktor_version")
    testImplementation("io.ktor:ktor-server-tests:$ktor_version")

    // Jackson
    implementation ("io.ktor:ktor-jackson:$ktor_version")

    // Exposed
    implementation("org.jetbrains.exposed:exposed-core:$exposedVersion")
    implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion")
    implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")

    // PostgreSQL
    implementation ("org.postgresql:postgresql:42.2.18")
}
@ddaypunk I think I did before but will try again, it just looks like the first build doesn't work right so I have to delete the build folder to force it to build stuff again
🤘 1
d
I feel as though I've had the same issue with Gradle
I think the file looks okay. Are you using gradle wrapper @YASAN ?
y
@ddaypunk I just have a gradle-wrapper.jar which I cannot open on IDEA and a gradle-wrapper.properties which just has some basic variables in it. Never manually edited them.
d
🤔
What ide are you in? IntelliJ?
y
Yes IntelliJ IDEA. And I used the Ktor plugin to create the project.
Although I am probably moving to Spring Boot with Kotlin since I can barely find any useful Ktor tutorials and its hard to figure these stuff out as an Android dev 😕
e
@YASAN when you run a task from the command line, for example
./gradlew build
, does it work?
y
@edrd it looks like it no longer happens so I cannot really test it via terminal. It probably is fixed due to me moving the project files into another folder & importing it as a new project.
👍 1
d
.