Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public class PlexusExtension implements BeforeEachCallback, AfterEachCallback {

@Override
public void beforeEach(ExtensionContext context) throws Exception {
extensionContextThreadLocal.set(context);
setTestBasedir(getDefaultBasedir(), context);

((DefaultPlexusContainer) getContainer(context))
Expand All @@ -88,6 +87,12 @@ public void beforeEach(ExtensionContext context) throws Exception {
}

private PlexusContainer setupContainer(ExtensionContext context) {
// Store the context in a thread local for static access
// must be done hear as this method is always executed
extensionContextThreadLocal.set(context);
context.getStore(PLEXUS_EXTENSION)
.put("threadLocalCloseable", (AutoCloseable) extensionContextThreadLocal::remove);

// ----------------------------------------------------------------------------
// Context Setup
// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -175,8 +180,6 @@ public void afterEach(ExtensionContext context) throws Exception {
if (container != null) {
container.dispose();
}
context.getStore(PLEXUS_EXTENSION).remove("testBasedir", String.class);
extensionContextThreadLocal.remove();
}

/**
Expand Down