Yeah, I've read those and explored the MavenSession API as I mentioned. I just haven't found the "bind this method call to that lifecycle phase" hook just yet. What i'm aiming for is trying to bind invocations of gradle tasks to certain maven lifecycles so that the maven invocation handles all the gradle calls and there's no need to manually invoke gradle at all. I *can* use <execution> blocks, and it may come to that, but that approach doesn't really allow for default bindings of tasks to phases. But I may just have to swallow that one.
On Mon, Aug 14, 2023 at 12:26 PM Nils Breunese <n...@breun.nl> wrote: > Justin Lee <j...@antwerkz.com> wrote: > > > I understand that. My question was doing that programmatically because > my > > situation is rather dynamic and codify it in the pom is not what I need. > > You wrote: "I'm trying to write a plugin (…) that can arbitrarily bind > functionality to different lifecycle phases based on the configuration in > the pom file." > > Maven executes a plugin goal in a lifecycle phase, either its default > phase, or the phase configured by a user. Users can bind plugin goals to > any lifecycle phase using the <executions> tag in the pom file. To me that > sounded basically like what you described you wanted. Can you maybe explain > your use case in some more detail to explain why it can’t use default’s > mechanism for binding plugin goals to phases? > > Note that a plugin cannot dynamically control in which phase it gets > executed itself, because when it’s executed, it’s already executed in a > particular phase. If you want to hook deeper into Maven’s behavior, you > will indeed need to look into writing either a build extension or (even > deeper) a core extension: > https://maven.apache.org/guides/mini/guide-using-extensions.html > > Nils. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >