Jar task ignores manifest setting

Here’s my entire project definition:

plugins {
    kotlin("jvm") version "1.9.0"
}

group = "com.example"
version = "0.0.1"

repositories.mavenCentral()

tasks {
    jar {
        manifest {
            attributes("Main-Class" to "com.example.ApplicationKt")
        }
    }
}

I’d expect to see Main-Class attr in the manifest of the generated jar, but manifest only contains this:

Manifest-Version: 1.0
Implementation-Title: demo
Implementation-Version: 0.0.1

What am I doing wrong? How to properly configure manifest?

Maybe you have some init script or whatever?
I literally copied your build script, run the jar task, looked inside, and got

Manifest-Version: 1.0
Main-Class: com.example.ApplicationKt

Yes! Init script. Thanks

1 Like