Skip to content

Conversation

@hcavarsan
Copy link

@hcavarsan hcavarsan commented Dec 15, 2025

What changes were proposed in this pull request?

Update build/make-distribution.sh to provide a error message when the bundled Maven wrapper (build/mvn) is not working, guiding users to specify an alternate Maven.

CleanShot 2025-12-16 at 10 40 45

Why are the changes needed?

The bundled Maven wrapper can fail silently or produce unusable output, causing build failures like:
CleanShot 2025-12-15 at 11 00 00

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 --version check with actionable error output:

  • Validates Maven works before proceeding with the build
  • If validation fails, exits with a clear message explaining how to use --mvn /path/to/mvn

Does 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.

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"
Copy link
Member

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

Copy link
Author

@hcavarsan hcavarsan Dec 16, 2025

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;
fi

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this sounds reasonable

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in b6fd49f

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now:
CleanShot 2025-12-16 at 10 40 45

@hcavarsan hcavarsan changed the title [BUILD] Fallback to system Maven when bundled Maven wrapper fails [BUILD] Improve error message when bundled Maven wrapper fails Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants