You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by on 2018/07/12 01:28:35 UTC
Maven Plugin Development and the @Produces
Hey Guys,
I'm developing my first maven plugin. I was curious, is there any way to use the @javax.enterprise.inject.Produces annotation?
Here's why I ask. I have my main mojo, but it is composed of several dependencies that are @Inject'd into the mojo. These submodules ('components') may have @Parameters. Of course, if you inject parameters into the submodules, when you run the helpmojo it doesn't know about those parameters so they'll be missing from your documentation.
Hence, I thought if put the Parameters in my mojo, then used @Produces annotations on some getters, I could inject those elsewhere.
Is there a better way to do all of this? Thanks!
-Jonathan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Maven Plugin Development and the @Produces
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Inject a component, set the current mojo and just "get" it when you need
from the component you can inject?
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 mer. 18 juil. 2018 à 07:01, exabrial@gmail.com <ex...@gmail.com> a
écrit :
> Unfortunately, my module is not being called, so I don't think it's
> supported.
>
> Is there *ANY* way to inject Configuration parameters into sub-modules?
> ANY possible way?
>
> On 2018/07/16 19:53:33, Romain Manni-Bucau <rm...@gmail.com> wrote:
> > Maven tries to limit that to jsr330 usage hoping it stays portable (
> > https://maven.apache.org/maven-jsr330.html). Probably just implement the
> > api and register the class in guice/sisu or plexus (old way). Will avoid
> > some headaches.
> >
> > Sisu-guice (the guice impl of maven) should support defining a named
> > AbstractModule with @Provides but not sure it is a safe usage.
> >
> > Le lun. 16 juil. 2018 21:19, exabrial@gmail.com <ex...@gmail.com> a
> > écrit :
> >
> > > I tried the @Provides annotation but it could not get it to supply a
> > > value. Do you have an example?
> > >
> > > On 2018/07/12 06:33:19, Romain Manni-Bucau <rm...@gmail.com>
> wrote:
> > > > Hi Jonathan,
> > > >
> > > > you can use Guice in plexus components but not CDI. the cdi-api.jar
> is a
> > > > transitive leaked dependency and almost nothing is supported in
> current
> > > > maven (there are several threads to drop it). To be concrete, only
> @Typed
> > > > is used.
> > > >
> > > > 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 jeu. 12 juil. 2018 à 08:12, exabrial@gmail.com <
> exabrial@gmail.com> a
> > > > écrit :
> > > >
> > > > > Hey Guys,
> > > > >
> > > > > I'm developing my first maven plugin. I was curious, is there any
> way
> > > to
> > > > > use the @javax.enterprise.inject.Produces annotation?
> > > > >
> > > > > Here's why I ask. I have my main mojo, but it is composed of
> several
> > > > > dependencies that are @Inject'd into the mojo. These submodules
> > > > > ('components') may have @Parameters. Of course, if you inject
> > > parameters
> > > > > into the submodules, when you run the helpmojo it doesn't know
> about
> > > those
> > > > > parameters so they'll be missing from your documentation.
> > > > >
> > > > > Hence, I thought if put the Parameters in my mojo, then used
> @Produces
> > > > > annotations on some getters, I could inject those elsewhere.
> > > > >
> > > > > Is there a better way to do all of this? Thanks!
> > > > > -Jonathan
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > > > For additional commands, e-mail: dev-help@maven.apache.org
> > > > >
> > > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: dev-help@maven.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
Re: Maven Plugin Development and the @Produces
Posted by .
Unfortunately, my module is not being called, so I don't think it's supported.
Is there *ANY* way to inject Configuration parameters into sub-modules? ANY possible way?
On 2018/07/16 19:53:33, Romain Manni-Bucau <rm...@gmail.com> wrote:
> Maven tries to limit that to jsr330 usage hoping it stays portable (
> https://maven.apache.org/maven-jsr330.html). Probably just implement the
> api and register the class in guice/sisu or plexus (old way). Will avoid
> some headaches.
>
> Sisu-guice (the guice impl of maven) should support defining a named
> AbstractModule with @Provides but not sure it is a safe usage.
>
> Le lun. 16 juil. 2018 21:19, exabrial@gmail.com <ex...@gmail.com> a
> écrit :
>
> > I tried the @Provides annotation but it could not get it to supply a
> > value. Do you have an example?
> >
> > On 2018/07/12 06:33:19, Romain Manni-Bucau <rm...@gmail.com> wrote:
> > > Hi Jonathan,
> > >
> > > you can use Guice in plexus components but not CDI. the cdi-api.jar is a
> > > transitive leaked dependency and almost nothing is supported in current
> > > maven (there are several threads to drop it). To be concrete, only @Typed
> > > is used.
> > >
> > > 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 jeu. 12 juil. 2018 à 08:12, exabrial@gmail.com <ex...@gmail.com> a
> > > écrit :
> > >
> > > > Hey Guys,
> > > >
> > > > I'm developing my first maven plugin. I was curious, is there any way
> > to
> > > > use the @javax.enterprise.inject.Produces annotation?
> > > >
> > > > Here's why I ask. I have my main mojo, but it is composed of several
> > > > dependencies that are @Inject'd into the mojo. These submodules
> > > > ('components') may have @Parameters. Of course, if you inject
> > parameters
> > > > into the submodules, when you run the helpmojo it doesn't know about
> > those
> > > > parameters so they'll be missing from your documentation.
> > > >
> > > > Hence, I thought if put the Parameters in my mojo, then used @Produces
> > > > annotations on some getters, I could inject those elsewhere.
> > > >
> > > > Is there a better way to do all of this? Thanks!
> > > > -Jonathan
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: dev-help@maven.apache.org
> > > >
> > > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Maven Plugin Development and the @Produces
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Maven tries to limit that to jsr330 usage hoping it stays portable (
https://maven.apache.org/maven-jsr330.html). Probably just implement the
api and register the class in guice/sisu or plexus (old way). Will avoid
some headaches.
Sisu-guice (the guice impl of maven) should support defining a named
AbstractModule with @Provides but not sure it is a safe usage.
Le lun. 16 juil. 2018 21:19, exabrial@gmail.com <ex...@gmail.com> a
écrit :
> I tried the @Provides annotation but it could not get it to supply a
> value. Do you have an example?
>
> On 2018/07/12 06:33:19, Romain Manni-Bucau <rm...@gmail.com> wrote:
> > Hi Jonathan,
> >
> > you can use Guice in plexus components but not CDI. the cdi-api.jar is a
> > transitive leaked dependency and almost nothing is supported in current
> > maven (there are several threads to drop it). To be concrete, only @Typed
> > is used.
> >
> > 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 jeu. 12 juil. 2018 à 08:12, exabrial@gmail.com <ex...@gmail.com> a
> > écrit :
> >
> > > Hey Guys,
> > >
> > > I'm developing my first maven plugin. I was curious, is there any way
> to
> > > use the @javax.enterprise.inject.Produces annotation?
> > >
> > > Here's why I ask. I have my main mojo, but it is composed of several
> > > dependencies that are @Inject'd into the mojo. These submodules
> > > ('components') may have @Parameters. Of course, if you inject
> parameters
> > > into the submodules, when you run the helpmojo it doesn't know about
> those
> > > parameters so they'll be missing from your documentation.
> > >
> > > Hence, I thought if put the Parameters in my mojo, then used @Produces
> > > annotations on some getters, I could inject those elsewhere.
> > >
> > > Is there a better way to do all of this? Thanks!
> > > -Jonathan
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: dev-help@maven.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
Re: Maven Plugin Development and the @Produces
Posted by .
I tried the @Provides annotation but it could not get it to supply a value. Do you have an example?
On 2018/07/12 06:33:19, Romain Manni-Bucau <rm...@gmail.com> wrote:
> Hi Jonathan,
>
> you can use Guice in plexus components but not CDI. the cdi-api.jar is a
> transitive leaked dependency and almost nothing is supported in current
> maven (there are several threads to drop it). To be concrete, only @Typed
> is used.
>
> 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 jeu. 12 juil. 2018 à 08:12, exabrial@gmail.com <ex...@gmail.com> a
> écrit :
>
> > Hey Guys,
> >
> > I'm developing my first maven plugin. I was curious, is there any way to
> > use the @javax.enterprise.inject.Produces annotation?
> >
> > Here's why I ask. I have my main mojo, but it is composed of several
> > dependencies that are @Inject'd into the mojo. These submodules
> > ('components') may have @Parameters. Of course, if you inject parameters
> > into the submodules, when you run the helpmojo it doesn't know about those
> > parameters so they'll be missing from your documentation.
> >
> > Hence, I thought if put the Parameters in my mojo, then used @Produces
> > annotations on some getters, I could inject those elsewhere.
> >
> > Is there a better way to do all of this? Thanks!
> > -Jonathan
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Maven Plugin Development and the @Produces
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Jonathan,
you can use Guice in plexus components but not CDI. the cdi-api.jar is a
transitive leaked dependency and almost nothing is supported in current
maven (there are several threads to drop it). To be concrete, only @Typed
is used.
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 jeu. 12 juil. 2018 à 08:12, exabrial@gmail.com <ex...@gmail.com> a
écrit :
> Hey Guys,
>
> I'm developing my first maven plugin. I was curious, is there any way to
> use the @javax.enterprise.inject.Produces annotation?
>
> Here's why I ask. I have my main mojo, but it is composed of several
> dependencies that are @Inject'd into the mojo. These submodules
> ('components') may have @Parameters. Of course, if you inject parameters
> into the submodules, when you run the helpmojo it doesn't know about those
> parameters so they'll be missing from your documentation.
>
> Hence, I thought if put the Parameters in my mojo, then used @Produces
> annotations on some getters, I could inject those elsewhere.
>
> Is there a better way to do all of this? Thanks!
> -Jonathan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>