Skip to content
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

[MNG-8447] Lossy ProblemCollector #1994

Merged
merged 29 commits into from
Dec 19, 2024
Merged

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Dec 17, 2024

Historically (from Maven3) "problem collection" (in various scenarios, like building effective settings and toolchains, to building models) were done by passing around List<Problem> structure. This proved quite ineffective, as in case of (really) huge projects with quite big count of problems reported choked Maven (but also produced unusable output). We are aware of projects producing 3 million warnings! Dumping all of them onto console/log makes really no sense.

This PR changes Maven that by default it reports "problems" (settings building, toolchains building, or model building) as one liner warnings: how much and where were problems collected. This produces much more less overwhelming output than happens on master. User can control "build errors" using -e, so mvn -e will dump errors on screen/log.

The new org.apache.maven.api.services.ProblemCollector<P> class, that is somewhat "drop in" replacement for List, but with huge difference: it is "lossy", in a way, it maintains counters precisely, but actual problem instances are simply dropped after threshold maven.builder.maxProblems is surpassed (default 100). See org.apache.maven.api.Constants#MAVEN_BUILDER_MAX_PROBLEMS.

Rules:

  • on problem addition counters are always updated
  • if below threshold, store the problem (and will be reported later to the user)
  • if above threshold, try to drop one problem with severity lower than currently reported problem, if succeeded, store the current problem, otherwise drop it

https://issues.apache.org/jira/browse/MNG-8447

@cstamas cstamas self-assigned this Dec 17, 2024
@cstamas cstamas changed the title Lossy ProblemCollector [MNG-8447] Lossy ProblemCollector Dec 17, 2024
@cstamas cstamas requested a review from gnodet December 17, 2024 18:24
@cstamas cstamas marked this pull request as ready for review December 18, 2024 12:16
@cstamas cstamas added this to the 4.0.0-rc-3 milestone Dec 18, 2024
@cstamas cstamas merged commit 0222aff into apache:master Dec 19, 2024
13 checks passed
@cstamas cstamas deleted the problem-collector branch December 19, 2024 14:50
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