Closed xzel23 closed 9 months ago
OK, after endless headaches (I'm neither an expert in Groovy nor in Kotlin) I found a workaround (tested with version 3.0.0 of the plugin).
Replace the secondaryLauncher
block with this:
val sld = SecondaryLauncherData("docdiffcli")
sld.mainClass = "com.dua3.docdiff.app.cli.Main"
sld.noConsole = false
sld.jvmArgs = listOf("-Xms512m", "-Xmx2g", "-XX:+UseG1GC")
secondaryLaunchers.add(sld)
I still don't get my head around what exactly is happaning here. But in IntelliJ I can see that the secondaryLauncher expects a LauncherData
instance:
LauncherData does not have a member called mainclass. So probably something needs to be changed to make secondaryLauncher expect SecondaryLauncherData instead of LauncherData.
Is it possible this either a bug or misunderstanding with the Kotlin DSL? I'm not able to reproduce this issue by adding these lines to an app built with Groovy DSL:
secondaryLauncher {
name = "docdiffcli"
noConsole = false
mainClass = "com.dua3.docdiff.app.cli.Main"
jvmArgs = ["-Xms512m", "-Xmx2g", "-XX:+UseG1GC"]
}
Yes, seems like something that works different in the Kotlin DSL. However my build file is rather big, with version catalog and all, so I'd rather not go back to groovy (and honestly I don't like Groovy because there are too many ambiguities).
Could you provide a repository with a minimal reproducible example?
I have created a minimal example that exposes the problem.
The solution with this as org.beryx.jlink.data.SecondaryLauncherData
does not seem to work either in the minimal example.
@airsquared I finally had time to look into this and have prepared a PR for this. Please apply.
Thanks! Merged
It's so funny seeing links to Aya in an issue like this! 🤣 thanks for the fix
I try to create a secondary launcher for my JavaFX app. The class
com.dua3.docdiff.app.fx.AppMain
starts a JavaFX application,com.dua3.docdiff.app.cli.Main
is a command line tool that does not use JavaFX. Both classes are in the same module.I have this in my Kotlin-DSL build file:
When I run
./gradlew jpackage
, I get the following error:(This is the localized message, it should translate to "application main class missing".)
Both launchers work if I comment out the other launcher (and replace
secondaryLauncher
withlauncher
).I have not idea what could be wrong since I clearly set
mainClass
for both launchers.The versions I am using are Gradle 8.4 and Java 21.0.1, jlink plugin version 3.0.0.