This is my first time deploying a ktor app to Heroku and i have been getting the error Unable to access jarfile
Below is my build.gradle.kts file.
I have been trying to go though documentation and other stackoverflow pages for help but could not figure what i wrong. I able to genarate the .jar file and build sucessfully on Heroku. I have attached the screenshot from the Heroku page, which shows the jar file being deployed in dynos. But still get the above error. Any help will be great.
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.com.intellij.openapi.vfs.StandardFileSystems.jar
val ktor_version: String by project
val kotlin_version: String by project
val logback_version: String by project
val exposed_version: String by project
val postgres_version: String by project
val hikari_version: String by project
plugins {
kotlin("jvm") version "1.9.22"
id("io.ktor.plugin") version "2.3.8"
kotlin("plugin.serialization") version "1.9.22"
id("com.github.johnrengelman.shadow") version "7.1.2"
}
group = "com.schoolcircle"
version = "0.0.1"
application {
mainClass.set("com.schoolcircle.ApplicationKt")
}
tasks {
withType<Jar> {
manifest {
attributes["Main-Class"] = "com.schoolcircle.ApplicationKt"
}
}
}
//tasks.shadowJar {
// manifest {
// attributes["Main-Class"] = application.mainClass.get()
// }
//}
repositories {
mavenCentral()
maven {
url = uri("https://dl.bintray.com/kotlin/exposed")
}
maven { url = uri("https://kotlin.bintray.com/ktor") }
maven {
url = uri("https://repo.spring.io/release")
}
google()
}
tasks {
create("stage").dependsOn("installDist")
}
tasks.test {
enabled = false
}
gradle.taskGraph.whenReady {
if (this.hasTask("stage")) {
tasks.test {
enabled = false
}
}
}
dependencies {
implementation("io.ktor:ktor-server-auth-jvm")
implementation("io.ktor:ktor-server-core-jvm")
implementation("io.ktor:ktor-server-auth-jwt-jvm")
implementation("io.ktor:ktor-server-sessions-jvm")
implementation("io.ktor:ktor-server-netty-jvm")
implementation("io.ktor:ktor-server-locations:$kotlin_version")
implementation("ch.qos.logback:logback-classic:$logback_version")
implementation("io.ktor:ktor-server-content-negotiation:$ktor_version")
implementation("io.ktor:ktor-serialization-jackson:$ktor_version")
testImplementation("io.ktor:ktor-server-tests-jvm")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
testImplementation ("io.ktor:ktor-server-tests:$ktor_version")
implementation("org.jetbrains.exposed:exposed-core:$exposed_version")
implementation("org.jetbrains.exposed:exposed-dao:$exposed_version")
implementation("org.jetbrains.exposed:exposed-jdbc:$exposed_version")
implementation("org.postgresql:postgresql:$postgres_version")
implementation("com.zaxxer:HikariCP:$hikari_version")
}
And my Procfile is
web: java -jar ./build/libs/school-backend-all.jar

Check the .gitignore file, if the build folder is added there, it can be a possibility that it may be added there and due to this the jar file is not able to be uploaded to heroku in the first place.