Improve the error message for empty mainClassName#1601
Merged
Conversation
Member
Goooler
commented
Aug 7, 2025
- CHANGELOG's "Unreleased" section has been updated, if applicable.
e2c3797 to
3fcbf63
Compare
3fcbf63 to
9387100
Compare
f90a851 to
3058c52
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves error handling for the Shadow plugin by providing a clearer error message when the main class is not specified or is empty. The changes ensure that users receive helpful feedback instead of encountering unclear failures when they forget to set the application's main class.
- Enhanced error message clarity for missing or empty main class configuration
- Added comprehensive test coverage for the empty main class scenario
- Updated changelog to document the improvement
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ShadowApplicationPlugin.kt | Replaced the implicit property input with explicit validation and improved error message for empty main class |
| ApplicationPluginTest.kt | Added test case to verify the new error message when main class is not set |
| docs/changes/README.md | Updated changelog to document the error message improvement |
Comments suppressed due to low confidence (1)
src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowApplicationPlugin.kt:131
- The removal of the inputs property declaration may affect Gradle's up-to-date checking and incremental builds. Consider adding the property back or ensuring that task inputs are properly declared elsewhere to maintain build performance.
tasks.shadowJar.configure { task ->
Goooler
commented
Aug 7, 2025
| protected open fun Project.configureShadowJarMainClass() { | ||
| val mainClassName = applicationExtension.mainClass | ||
| tasks.shadowJar.configure { task -> | ||
| task.inputs.property("mainClassName", mainClassName) |
Member
Author
There was a problem hiding this comment.
This will result in the shadowJar task not being re-run after applicationExtension.mainClass changed.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.