Skip to content

#609 Support application mainClass property as fallback of mainClassName#612

Merged
johnrengelman merged 2 commits intoGradleUp:masterfrom
nhumblot:609_support_application_mainClass
Feb 21, 2021
Merged

#609 Support application mainClass property as fallback of mainClassName#612
johnrengelman merged 2 commits intoGradleUp:masterfrom
nhumblot:609_support_application_mainClass

Conversation

@nhumblot
Copy link
Copy Markdown
Contributor

@nhumblot nhumblot commented Nov 8, 2020

Fix #609

Hello,

Starting from Gradle 6.7, application.mainClassName property is deprecated. application.mainClass (introduced in Gradle 6.4) is the property to use.

The goal of this pull request is to allow projects using shadow plugin to transition to this new property. This change has been done to be non breaking by still picking first mainClassName and using mainClass as a fall-back.

This way, older configurations with mainClassName will still works as previously, but newer configurations with mainClass will also works.

One thing to note. This change won't produce an error for newer configurations any more. It won't produce a warning while the shadow plugin will be using Gradle 6.6.

It will still produce a warning when the shadow plugin Gradle version is upgraded to 6.7. To prevent such warning, mainClass property has to be picked before mainClassName property, but that would apply a small change in the behaviour of the plugin.

If maintainers of this plugin prefer to perform directly a change that won't produce a warning in the latter case, I'm open to adapt this pull request.

Feel free to comment this pull request, I will adapt the code based on the received comments. Please note this is my first pull request on this plugin, and my first pull request on any Gradle plugin so apply any special care you would in such case.

Kind regards

Additional information:

edit: I'm sorry for the force push (with lease), the user was wrongly configured.

@vojkny
Copy link
Copy Markdown

vojkny commented Nov 28, 2020

can we get this merged?

@xeruf
Copy link
Copy Markdown

xeruf commented Dec 28, 2020

Also fixes #625
Please merge!

@xeruf
Copy link
Copy Markdown

xeruf commented Jan 25, 2021

@johnrengelman please 🙏

@kleini
Copy link
Copy Markdown

kleini commented Feb 16, 2021

Next one stumbling over this unsolved deprecation.

@johnrengelman johnrengelman added this to the 6.2 milestone Feb 21, 2021
@johnrengelman johnrengelman merged commit 7b68fdc into GradleUp:master Feb 21, 2021
@dinomite
Copy link
Copy Markdown

@johnrengelman Thanks!

@nhumblot nhumblot deleted the 609_support_application_mainClass branch March 6, 2021 15:17
NiccoMlt added a commit to NiccoMlt/sample-gradle-project that referenced this pull request Mar 26, 2021
waiting for fix from PR GradleUp/shadow#612 to be released in a new version of com.github.johnrengelman.shadow
NiccoMlt added a commit to NiccoMlt/sample-gradle-project that referenced this pull request Mar 26, 2021
waiting for fix from PR GradleUp/shadow#612 to be released in a new version of com.github.johnrengelman.shadow
NiccoMlt added a commit to NiccoMlt/sample-javafx-project that referenced this pull request Mar 26, 2021
waiting for fix from PR GradleUp/shadow#612 to be released in a new version of com.github.johnrengelman.shadow

(cherry picked from commit 4122bbf7fc8eaca494129dc65f3e380f331f6581)
@xeruf
Copy link
Copy Markdown

xeruf commented Mar 29, 2021

We also need a new release now ;)

FilippoGurioli pushed a commit to matteosusca/OOP21-Mtl-Shot that referenced this pull request May 20, 2022
waiting for fix from PR GradleUp/shadow#612 to be released in a new version of com.github.johnrengelman.shadow

(cherry picked from commit 4122bbf7fc8eaca494129dc65f3e380f331f6581)
@kakira9618 kakira9618 mentioned this pull request Oct 2, 2025
8 tasks
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

Successfully merging this pull request may close these issues.

JavaApplication.setMainClassName(String) removal in Gradle 8.0

8 participants