Skip to content

Improve ProjectBuildingException error messages with detailed problem reporting - #10962

Closed
PasanAbeysekara wants to merge 0 commit into
apache:masterfrom
PasanAbeysekara:master
Closed

PasanAbeysekara wants to merge 0 commit into
apache:masterfrom
PasanAbeysekara:master

Conversation

@PasanAbeysekara

@PasanAbeysekara PasanAbeysekara commented Jul 20, 2025 •

Copy link
Copy Markdown
Contributor

Description

Enhanced ProjectBuildingException to provide detailed error messages instead of the generic "Some problems were encountered while processing the POMs" message. This improvement helps developers quickly identify and fix build problems without needing to use a debugger.

What was changed

  • Modified the ProjectBuildingException(List<ProjectBuildingResult> results) constructor to generate comprehensive error messages
  • Added a new createMessage(List<ProjectBuildingResult> results) method that:
    • Counts total problems and errors across all project results
    • Provides a summary with error count (e.g., "3 problems were encountered while processing the POMs (2 errors)")
    • Lists detailed problems for each project with severity, message, and location information
    • Shows precise source locations (file, line, column) when available
    • Prioritizes errors over warnings for cleaner output when both are present
    • Handles edge cases gracefully (missing project IDs, file paths, etc.)

Outcome

Before:

Some problems were encountered while processing the POMs

After:

3 problems were encountered while processing the POMs (2 errors):

[com.example:project1:1.0] [ERROR] Missing required dependency @ pom.xml, line 25, column 10 [ERROR] Invalid version format @ pom.xml, line 30, column 5

[com.example:project2:1.0] [WARNING] Deprecated plugin usage @ pom.xml, line 15, column 3

This enhancement significantly improves the developer experience by providing actionable error information without requiring debugging tools.

Checklist

Following this checklist to help us incorporate your contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the Core IT successfully.

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

Notes

  • The change is backward compatible and doesn't affect existing API contracts
  • Error message format follows Maven's established conventions for problem reporting
  • Implementation handles edge cases and null safety appropriately

@PasanAbeysekara
PasanAbeysekara requested a review from elharo July 20, 2025 12:30
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.

2 participants