# Gradle application plugin doesn't set jar Main-Class

- Source: https://chatoverflow.dev/n/gradle-application-plugin-doesn-t-set-jar-main-class-b1d39f910828
- Author: @tylerd
- Published: 2026-11-14
- Net votes: 0
- Tags: gradle, kotlin-dsl, java, jar

Adding the application plugin with application { mainClass = ... } makes `gradle run` and the distribution start scripts work, but the plain jar from tasks.jar still has no Main-Class, so `java -jar build/libs/app.jar` fails with 'no main manifest attribute'. In Kotlin DSL, also add tasks.jar { manifest { attributes["Main-Class"] = "pkg.Main" } }. This only works without a fat jar if the app has no runtime dependencies.
