Slackbot
11/24/2022, 3:51 AMChris Lee
11/24/2022, 3:59 AMmainClass
is used in generating the application scripts, not for the manifest. If your manifest requires specific entries (should it, if application
plugin is used?) you’ll need to add those.Chris Lee
11/24/2022, 4:00 AMapplication
the distZip
(or distTar
) targets should be used to build the application.Chris Lee
11/24/2022, 4:01 AMEric Kolotyluk
11/24/2022, 4:19 AMChris Lee
11/24/2022, 4:22 AMmanifest {
attributes(
"Implementation-Title" to "Gradle",
"Implementation-Version" to archiveVersion
)
}
From these docs.Eric Kolotyluk
11/24/2022, 4:25 AMChris Lee
11/24/2022, 4:26 AMtasks.named<Jar>("jar")
- manifest is configurable on there.Eric Kolotyluk
11/24/2022, 4:27 AMjar {
. . .
}
Chris Lee
11/24/2022, 4:27 AMtasks.named
.Eric Kolotyluk
11/24/2022, 4:28 AMjar { ... }
IntelliJ flags that as an error.Chris Lee
11/24/2022, 4:29 AMtasks.jar
would be the syntax to grab the jar task.Eric Kolotyluk
11/24/2022, 4:33 AMEric Kolotyluk
11/24/2022, 4:34 AMtasks.named<Jar>("jar") {
manifest {
attributes {
"Main-Class" to "com.forgerock.poc.loom.Application"
}
}
}
does not workChris Lee
11/24/2022, 4:34 AMEric Kolotyluk
11/24/2022, 4:35 AMChris Lee
11/24/2022, 4:35 AMjava-library
plugin as it doesn’t appear you are using the application aspects of that plugin.Eric Kolotyluk
11/24/2022, 4:37 AMChris Lee
11/24/2022, 4:37 AMChris Lee
11/24/2022, 4:37 AMtasks.named<Jar>("jar") {
manifest {
attributes(
"Main-Class" to "com.forgerock.poc.loom.Application"
)
}
}
Chris Lee
11/24/2022, 4:38 AMEric Kolotyluk
11/24/2022, 4:39 AMEric Kolotyluk
11/24/2022, 4:39 AMChris Lee
11/24/2022, 4:39 AMEric Kolotyluk
11/24/2022, 4:40 AMEric Kolotyluk
11/24/2022, 4:42 AMjar {
manifest {
attributes(
"Main-Class" to "com.forgerock.poc.loom.Application"
)
}
}
or
Jar {
manifest {
attributes(
"Main-Class" to "com.forgerock.poc.loom.Application"
)
}
}
Eric Kolotyluk
11/24/2022, 4:47 AMApplication
plug-in should configure the Jar
task with Main-Class
attribute.Chris Lee
11/24/2022, 4:55 AMEric Kolotyluk
11/24/2022, 4:58 AM./gradlew run
does not work, and I am trying to figure that out...Eric Kolotyluk
11/24/2022, 5:22 AMEric Kolotyluk
11/24/2022, 5:24 AMVampire
11/24/2022, 7:59 AMAnd, it makes no sense that I cannot say.jar { ... }
Just use
tasks.jar { ... }
. For plugins applied using the plugins { ... }
block there are type-safe accessors generated for Kotlin DSL. This is not breaking task configuration avoidance. In Groovy DSL yes afair, but not in Kotlin DSL.Vampire
11/24/2022, 8:06 AMMy expectation is still that the Application plug-in should configure the Jar task with Main-Class attribute.
Why? The whole sense of that plugin is, to build a proper distribution with your code, your dependencies, maybe additional files like logging configuration, and start scripts that run the application. It does neither builds a bad-practice fat jar that repackages the dependencies, nor a runnable jar with class path and main class manifest entries. If the
run
task does not work, this has absolutely nothing to do with the jars manifest entries as the run
task added by the application
plugin does not run it as runnable jar. It does not even build the jar iirc. If it does not work, better provide the error you get with that so we can help to fix the actual problem. ;-)