Skip to content

Close the remote resources classloader after execution (#273) - #281

Open
elharo wants to merge 1 commit into
masterfrom
fix/issue-273-close-classloader
Open

Close the remote resources classloader after execution (#273)#281
elharo wants to merge 1 commit into
masterfrom
fix/issue-273-close-classloader

Conversation

@elharo

@elharo elharo commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Closes #273

Test-first

Added RemoteResourcesMojoTest.testClassLoaderIsClosedAfterExecution(), which executes the mojo against a bundle and then asserts that the plugin's RemoteResourcesClassLoader no longer serves resources from the bundle jars (i.e. it has been closed).

Before the fix the mojo never even kept a reference to close, so the test fails.

Fix

AbstractProcessRemoteResourcesMojo now stores the RemoteResourcesClassLoader it creates and closes it in the finally block of execute() (after restoring the original context classloader), releasing the bundle jar file handles instead of leaking them per execution. The initalizeClassloader return type was narrowed to RemoteResourcesClassLoader to match.

Verification

  • New test fails before the fix, passes after.
  • mvn verify passes (11 unit tests, RAT, checkstyle).
  • mvn spotless:apply reports no formatting changes.

@elharo elharo added the bug Something isn't working label Aug 2, 2026
@elharo
elharo requested a review from markt-asf August 2, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RemoteResourcesClassLoader is created per execution and never closed

1 participant