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

Override Main-Class with custom value #613

Closed
aalmiray opened this issue Nov 9, 2020 · 0 comments · Fixed by #1182
Closed

Override Main-Class with custom value #613

aalmiray opened this issue Nov 9, 2020 · 0 comments · Fixed by #1182
Labels
Milestone

Comments

@aalmiray
Copy link
Contributor

aalmiray commented Nov 9, 2020

Shadow Version

6.1.0

Gradle Version

6.3

Expected Behavior

A project with application and shadow plugins applied.
The project makes use of Java modules, thus mainClassName is set to

ext.moduleName = 'org.kordamp.ikonli.browser'
ext.moduleMainClass = 'org.kordamp.ikonli.browser.Launcher'

mainClassName = "${moduleName}/${moduleMainClass}"

The shaded JAR should not be a modular JAR thus its entry point should only be moduleMainClass.

shadowJar {
    manifest {
        attributes('Main-Class': moduleMainClass)
    }
}

Should result in the manifest containing an entry as the following one

Main-Class: org.kordamp.ikonli.browser.Launcher

Actual Behavior

The generated manifest contains the full modularized main class

Main-Class: org.kordamp.ikonli.browser/org.kordamp.ikonli.browser.Launch
  er

Even if the following is added

shadowJar.doLast {
    manifest.attributes('Main-Class': moduleMainClass)
}

It seems https://github.com/johnrengelman/shadow/blob/master/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/ShadowApplicationPlugin.groovy#L59-L64 always takes effect no matter what.

@johnrengelman johnrengelman added this to the 6.2 milestone Feb 21, 2021
@johnrengelman johnrengelman modified the milestones: 7.0, 8.0 Apr 26, 2021
@johnrengelman johnrengelman modified the milestones: 8.0, Next Feb 25, 2023
@Goooler Goooler added the bug label Jan 23, 2025
@Goooler Goooler marked this as a duplicate of #515 Jan 24, 2025
@Goooler Goooler marked this as a duplicate of #130 Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants