Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 20, 2025

This PR introduces a new ExtensionResolutionExceptionFacade in org.eclipse.m2e.maven.runtime to abstract the handling of ExtensionResolutionException, following the same pattern as the existing LifecycleExecutionPlanCalculatorFacade.

Background

Maven 4.x may introduce API changes to ExtensionResolutionException. To prepare for this and maintain compatibility across Maven versions, we need a facade pattern that isolates direct usage of this exception class.

Changes

New Facade Class

Created ExtensionResolutionExceptionFacade with:

  • Constructor that takes an ExtensionResolutionException
  • Method throwForFile(File file) that throws PlexusContainerException with contextual information
  • Proper null checking and documentation

Updated PlexusContainerManager

Refactored the exception handling in PlexusContainerManager.aquire(File basedir):

  • Replaced direct ExtensionResolutionException handling with the facade
  • Simplified exception conversion from 9 lines to 2 lines
  • Maintained the same functionality while providing better abstraction

Example Usage

try {
  plexusContainer = newPlexusContainer(canonicalDirectory, loggerManager, mavenConfiguration);
} catch(ExtensionResolutionException e) {
  File file = new File(directory, IMavenPlexusContainer.EXTENSIONS_FILENAME);
  new ExtensionResolutionExceptionFacade(e).throwForFile(file);
}

Benefits

  • Future-proof: Enables different implementations for Maven 3.x and 4.x
  • Consistent pattern: Follows the established facade pattern used elsewhere in the codebase
  • Minimal changes: Surgical modification with no behavior changes
  • Better abstraction: Isolates Maven version-specific API usage to the runtime bundle

This change is a prerequisite for supporting Maven 4.x while maintaining backward compatibility with Maven 3.x.

Original prompt

Facade for transforming ExtensionResolutionException into PlexusContainerException

We need a new ExtensionResolutionExceptionFacade in org.eclipse.m2e.maven.runtime that takes a ExtensionResolutionException and has a method throwForFile(File file) throws PlexusContainerException so we can have different implementation for Maven 3.x and 4.x like we did for the LifecycleExecutionPlanCalculatorFacade already


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Add facade for transforming ExtensionResolutionException Add ExtensionResolutionExceptionFacade for Maven 3.x/4.x compatibility Oct 20, 2025
Copilot AI requested a review from laeubi October 20, 2025 11:13
@laeubi laeubi marked this pull request as ready for review October 20, 2025 12:07
@laeubi laeubi force-pushed the copilot/add-extension-resolution-facade branch from e99d92e to 7612143 Compare October 20, 2025 12:10
@github-actions
Copy link

Test Results

  324 files  ±0    324 suites  ±0   1h 0m 33s ⏱️ +35s
  692 tests ±0    669 ✅ ±0  21 💤 ±0  1 ❌ ±0  1 🔥 ±0 
2 076 runs  ±0  2 011 ✅ ±0  63 💤 ±0  1 ❌ ±0  1 🔥 ±0 

For more details on these failures and errors, see this check.

Results for commit 7612143. ± Comparison against base commit 4963def.

@laeubi laeubi merged commit 363672e into main Oct 20, 2025
8 of 12 checks passed
@HannesWell HannesWell deleted the copilot/add-extension-resolution-facade branch October 26, 2025 15:55
@HannesWell HannesWell added this to the 2.10.0 milestone Dec 3, 2025
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