Hi Romain,

I agree that project-scoped containers might break existing service
overrides.

I also think 1 session = 1 container is a cleaner approach, especially if
we can handle container reuse in mvnd with a proper cache key.

My main concern is how we handle extension configuration when the same
extension is used by multiple projects with different configurations. We
need to avoid configuration leaking between projects.

I was exploring project-scoped provider contexts to handle this, but I
think your suggestion is worth investigating before going further.

What would you suggest for handling project-specific configuration in a
session-scoped container?

Best regards,
Abdul Hannan

On Fri, 27 Nov 2026 at 23:17, Romain Manni-Bucau <[email protected]>
wrote:

> Hi Abdul,
>
> What's your take on it?
>
> I tend to think we can't make it project scope only cause it would break
> some override but also wonder why we don't do 1 session = 1 container, sure
> there are some cases which will break today but sounds like the easiest to
> make work, even in mvnd (with a good cache key).
>
> Romain Manni-Bucau
> @rmannibucau <https://x.com/rmannibucau> | .NET Blog
> <https://dotnetbirdie.github.io/> | Blog <https://rmannibucau.github.io/>
> | Old
> Blog <http://rmannibucau.wordpress.com> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | Book
> <
> https://www.packtpub.com/en-us/product/java-ee-8-high-performance-9781788473064
> >
> Javaccino <https://javaccino.dev/> founder (Java/.NET service - contact
> via
> linkedin)
>
>
> Le ven. 27 nov. 2026 à 18:31, Abdul Hannan <[email protected]>
> a
> écrit :
>
> > Hi everyone,
> >
> > I've been working on Maven issue #13989: Support pure maven-di build
> > extensions.
> >
> > The implementation now supports project-aware native type and packaging
> > resolution for pure V4 extensions and V4 plugins used as build
> extensions.
> > It also handles project-specific extension configuration when multiple
> > projects share the same extension artifact.
> >
> > The targeted validation currently passes:
> >
> > - 65 focused unit tests.
> > - Full 88-module integration "verify".
> > - Pure V4 extension integration test.
> > - Plugin-as-extension configuration test, including parallel projects
> with
> > different configurations.
> > - Legacy extension compatibility test.
> >
> > During a subsequent lifecycle review, I identified one architectural
> > question that I would like to clarify before considering the
> implementation
> > complete.
> >
> > Currently, native V4 build-extension providers are discovered into both:
> >
> > 1. The shared root Maven injector.
> > 2. Project-owned injectors, where providers receive project-specific
> > configuration.
> >
> > Project-owned injectors are disposed at "SessionEnded". However,
> > registrations in the shared root injector remain, meaning extension
> classes
> > and their classloaders can remain reachable after the session ends when
> the
> > Maven container is reused.
> >
> > I see two possible directions:
> >
> > Option A – Container-lifetime registration
> >
> > Keep root-injector registrations and explicitly treat build-extension
> > provider visibility and retention as lasting for the lifetime of the
> Maven
> > container. This preserves session-level lookup compatibility but retains
> > extension references beyond individual sessions.
> >
> > Option B – Project-scoped registration
> >
> > Keep project-specific build-extension providers exclusively in
> > project-owned injectors, while retaining root registration for core and
> > genuinely container-scoped services. This would give extension providers
> a
> > more clearly defined project/session lifecycle, but changes the
> visibility
> > semantics of session-level service lookup.
> >
> > I do not think selective unbinding is safe with the current injector
> > implementation because dependent bindings, singleton instances, and
> > concurrent lookups may retain references to the extension.
> >
> > My question is:
> >
> > Should V4 build-extension providers be available through session-level
> > service lookup, or should their visibility be limited to project-aware
> > lookup APIs?
> >
> > I would appreciate guidance on the intended lifecycle and visibility
> > contract before making further architectural changes.
> >
> > Thanks!
> >
>

Reply via email to