Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property 'mainClass' not set in 'secondaryLauncher' block #213

Closed
HGuillemet opened this issue Apr 2, 2022 · 3 comments
Closed

Property 'mainClass' not set in 'secondaryLauncher' block #213

HGuillemet opened this issue Apr 2, 2022 · 3 comments

Comments

@HGuillemet
Copy link

When defining a secondary launcher with Kotlin DSL:

jlink {
    secondaryLauncher {
        name = "my-additional-app"
        mainClass.set("org.example.MyAdditionalApp")
        args = listOf("--user", "emma")
    }
}

Gradle complains with:

Property 'mainClass' not set in 'secondaryLauncher' block

Is there something I'm doing wrong ?

BTW, the example in the documention for Kotlin DSL reads:

        mainClass = "org.example.MyAdditionalApp"

which also triggers an error:

Type mismatch: inferred type is String but Property<String!>! was expected
@airsquared
Copy link
Collaborator

airsquared commented Apr 10, 2023

Same issue with Groovy DSL.

Caused by: org.gradle.api.GradleException: Property 'mainClass' not set in 'secondaryLauncher' block
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
	at org.beryx.jlink.data.SecondaryLauncherData$_check_closure1.doCall(SecondaryLauncherData.groovy:39)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at org.beryx.jlink.data.SecondaryLauncherData.check(SecondaryLauncherData.groovy:38)
	at org.beryx.jlink.data.JlinkPluginExtension.secondaryLauncher(JlinkPluginExtension.groovy:182)
	at org.beryx.jlink.data.JlinkPluginExtension_Decorated.secondaryLauncher(Unknown Source)
jlink {
    ...
    launcher {
        noConsole = true
    }
    secondaryLauncher {
        name = 'blobsaver-console'
        mainClass = mainClassName
        noConsole = false
    }
}

@airsquared
Copy link
Collaborator

Managed to get past this by also specifying moduleName but then I run into adoptium/adoptium-support#769.

@airsquared airsquared added the Pending Release This issue has been fixed in master and is awaiting a release label Sep 24, 2023
@airsquared
Copy link
Collaborator

Fixed in v3.0.0.

@airsquared airsquared removed the Pending Release This issue has been fixed in master and is awaiting a release label Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants