*ctx.session.container* ?

Le mar. 22 nov. 2022 à 16:23, Patrick Plenefisch <[email protected]> a
écrit :

> No, how would I do that with the released version of Mojo today? I know the
> standard version of injecting for java uses a field and an annotation, but
> I'm not writing java, and I don't know how to adapt that to my polyglot
> pom-inline code:
> https://github.com/jruby/jruby/blob/master/lib/pom.rb#L209
>
> Patrick
>
> On Tue, Nov 22, 2022 at 10:13 AM Romain Manni-Bucau <[email protected]
> >
> wrote:
>
> > Hi Patrick,
> >
> > Did you try injecting PlexusContainer?
> > It is not the most sexy and modern way to do it but it fits quite well
> the
> > scripting language since the container enables to lookup anything, it is
> > just a matter of injecting it in the mojo then forwarding it to the
> script.
> >
> > Side note: I assume a more modern solution is to inject the sisu
> > BeanLocator but its package is not exposed to mojo (intentionally) so it
> > can be trickier to play with ClassRealms to get it.
> >
> > I would also avoid the generation trick since it will also have pitfalls
> > (leaks, manual registration, cache) and is not simpler.
> >
> > Hope it helps a bit.
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://rmannibucau.metawerx.net/> | Old Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> > <
> >
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> > >
> >
> >
> > Le mar. 22 nov. 2022 à 16:04, Patrick Plenefisch <[email protected]> a
> > écrit :
> >
> > > Hi,
> > > How can I query a specific dependency's *resolved* transitive
> > dependencies
> > > inside a class executed by a mojo? I have access to session and
> project,
> > > and that's it.
> > > I looked at DependencyGraphBuilder and the underlying
> > > ProjectDependenciesResolver, but those seem to be injected. While I can
> > > generate a class at runtime, I don't see how to access the injector
> even
> > if
> > > I have a class
> > >
> > > The environment I'm running inside is JRuby inside
> > >
> > >
> >
> https://github.com/takari/polyglot-maven/blob/master/polyglot-maven-plugin/src/main/java/org/sonatype/maven/polyglot/plugin/ExecuteMojo.java
> > > which is why I can't just use an @Inject annotation. But, being JRuby,
> I
> > > can easily generate classes at runtime if necessary.
> > >
> > > How can I go about this?
> > >
> > > Thanks,
> > >
> > > Patrick
> > >
> >
>

Reply via email to