Skip to content

[maven-4.0.x] Backport bug fixes from master to maven-4.0.x#12091

Merged
gnodet merged 5 commits into
apache:maven-4.0.xfrom
gnodet:backport/maven-4.0.x/bug-fixes
May 19, 2026
Merged

[maven-4.0.x] Backport bug fixes from master to maven-4.0.x#12091
gnodet merged 5 commits into
apache:maven-4.0.xfrom
gnodet:backport/maven-4.0.x/bug-fixes

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented May 19, 2026

Summary

Backport 5 bug fixes from master that are applicable to the maven-4.0.x branch:

  1. Add Maven version to error message when rejecting model versions (Add Maven version to error message when rejecting model versions #10921) — helps users understand which Maven version they need when a model version is rejected.
  2. Improve ProjectBuildingException error messages with detailed problem reporting (Improve ProjectBuildingException error messages with detailed problem reporting #10975) — clearer error messages with detailed problem information.
  3. Improve dependency scope validation error messages for import scope (Improve dependency scope validation error messages for import scope #10991) — better error messages when import scope is misused, distinguishing between dependency and dependency management contexts.
  4. Throw ProjectBuildingException for reactor cycles (Fix #10950: Replace raw RuntimeException on reactor cycle with ProjectBuildingExc… #11091, fixes DeafultProjectBuilder throws raw RuntimeException #10950) — wraps CycleDetectedException in ProjectBuildingException instead of RuntimeException, providing meaningful error output.
  5. Fix NullPointerException when clearing project properties (fixes NullPointerException trying to clear project properties #11552) — OrderedProperties.clear() now also clears the keyOrder list to prevent inconsistent state.

Test plan

  • Compilation verified (mvn install -pl impl/maven-impl,impl/maven-core -DskipTests -am)
  • All 527 tests pass (mvn test -pl impl/maven-impl,impl/maven-core — 0 failures, 0 errors)
  • Full CI validation

Claude Code on behalf of Guillaume Nodet

@gnodet gnodet added this to the 4.0.0-rc-6 milestone May 19, 2026
gnodet and others added 5 commits May 19, 2026 11:08
…che#10921)

Port apache#10899 to master, using Session.getMavenVersion() instead of reading properties file.

- Modified validateModelVersion() to accept Session parameter and include Maven version in error messages
- Updated error messages to be single-line and consistent with Maven's style
- Enhanced error messages show which Maven version is rejecting the model version
- Added test coverage to verify Maven version is included in error messages

This helps users (especially IDE users like NetBeans) understand version compatibility issues more clearly.
… reporting (apache#10975)

* Refactor ProjectBuildingException constructors for improved clarity

* Add unit tests for ProjectBuildingException message generation

* Refactor ProjectBuildingException for improved clarity and maintainability

* Add unit tests for ProjectBuildingException to enhance message validation

* style: Apply Spotless formatting

* Refactor createMessage method to improve error counting logic in ProjectBuildingException

* Refactor ProjectBuildingException for improved clarity and maintainability

* Refactor createMessage method to streamline error message formattingRefactor createMessage method to streamline error message formatting

* Refactor:Spotless formating
…pache#10991)

- Enhance error message when 'import' scope is used incorrectly in regular dependencies
- Provide clear guidance that 'import' scope is only valid in <dependencyManagement> sections
- Replace generic error message with context-aware validation
- Update both Maven 3 (compat) and Maven 4 (impl) implementations for consistency
- Update tests to verify the improved error messages
- Fix grammar in comments (don't -> not)
- Apply spotless formatting

Before: 'dependencies.dependency.scope' must be one of [provided, compile, runtime, test, system] but is 'import'.
After:  'dependencies.dependency.scope' has scope 'import'. The 'import' scope is only valid in <dependencyManagement> sections.

This addresses the confusion reported in faktorips/faktorips.base#70
where users receive misleading error messages that suggest 'import' scope is never valid,
when it's actually valid in dependency management sections with type=pom.
…; keep CycleDetectedException as cause. (apache#11091)

Non-cycle model problems still use ProjectBuildingException(results).
Remove misleading comment about projectId/pomFile.
@gnodet gnodet force-pushed the backport/maven-4.0.x/bug-fixes branch from e2e8f65 to 31b9d08 Compare May 19, 2026 09:08
@gnodet gnodet changed the title Backport bug fixes from master to maven-4.0.x [maven-4.0.x] Backport bug fixes from master to maven-4.0.x May 19, 2026
@gnodet gnodet merged commit b8a0ae0 into apache:maven-4.0.x May 19, 2026
41 of 42 checks passed
@github-actions
Copy link
Copy Markdown

@gnodet Please assign appropriate label to PR according to the type of change.

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.

5 participants