I’m trying to build a fat jar, but I don’t know what I should provide as ‘Main-Class’. The program consists of a Kotlin file, name “App.kt” with a single main method like this:
fun main(args: Array<String>) {
println("hello, world!")
}
The Gradle build file looks like this:
group 'com.example'
version '1.0'
buildscript {
ext.kotlin_version = '1.0.3'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
task bigJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Table of Contents Fix for Hugo',
'Implementation-Version': version,
'Main-Class': 'com.example.project.App'
}
baseName = project.name
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
But if I try to execute the jar file, I get the error that the Main class “com.example.project.App” could not be found.
What is the correct main class name?