Skip to content

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
@jira-importer
Copy link

Resolve #9407

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.

3 participants