1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-25 16:07:12 -07:00

Use the default jar file if no Main-Class attribute was found.

Fixes https://github.com/cbeust/kobalt/issues/384
This commit is contained in:
Cedric Beust 2017-04-03 09:33:00 -07:00
parent c5405177b5
commit ed9c4e6636

View file

@ -100,7 +100,10 @@ class ApplicationPlugin @Inject constructor(val configActor: ConfigActor<Applica
}
private fun runJarFile(project: Project, context: KobaltContext, config: ApplicationConfig) : TaskResult {
// If the user specified a Main-Class attribute when creating their jar file manifest, use that. Otherwise,
// use the default jar file name and hope there's a main class in it
val fileName = project.projectProperties.get(Archives.JAR_NAME_WITH_MAIN_CLASS)?.toString()
?: project.projectProperties.get(Archives.JAR_NAME)?.toString()
?: throw KobaltException("Couldn't find any jar file with a main class in it")
val jarFileName = KFiles.joinDir(KFiles.libsDir(project), fileName)