-
Notifications
You must be signed in to change notification settings - Fork 408
[BUILD] Improve error message when bundled Maven wrapper fails #3566
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
base: main
Are you sure you want to change the base?
Conversation
build/make-distribution.sh
Outdated
| echo -e "Warning: Maven '$MVN' not working, trying system 'mvn'..." | ||
| if [ `command -v mvn` ] && mvn --version &>/dev/null; then | ||
| MVN="mvn" | ||
| echo "Using system Maven: $MVN" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-fail is an expected behavior, it's a dangerous fallback to system mvn without version checking.
you can use the system mvn by passing --mvn /path/of/mvn explicitly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pan3793 got it, makes sense. but the thing is… now when the bundled maven fails it just exits without any helpful message, so users don't know what to do. maybe just improving the error output would work?
if ! "$MVN" --version &>/dev/null; then
echo -e "Could not execute Maven command: '$MVN'."
echo " Use --mvn /path/to/mvn to specify an alternate Maven."
exit -1;
fiThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this sounds reasonable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated in b6fd49f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

What changes were proposed in this pull request?
Update
build/make-distribution.shto provide a error message when the bundled Maven wrapper (build/mvn) is not working, guiding users to specify an alternate Maven.Why are the changes needed?
The bundled Maven wrapper can fail silently or produce unusable output, causing build failures like:

When the bundled Maven doesn't work correctly, the script fails without any helpful message, leaving users unsure how to proceed. This change adds a
--versioncheck with actionable error output:--mvn /path/to/mvnDoes this PR introduce any user-facing change?
No functional change. Error messaging is improved when Maven validation fails.
How was this patch tested?
Tested build script with broken bundled Maven, just confirm error message is displayed with instructions to specify alternate Maven path.