It just occurred to me that yes, you can inject the plugin’s dependencies for the custom plugin. The Mojo will have code like:
71 <http://anthonywhitford.com/lombok.maven/lombok-maven-plugin/xref/lombok/maven/AbstractDelombokMojo.html#L71> /** 72 <http://anthonywhitford.com/lombok.maven/lombok-maven-plugin/xref/lombok/maven/AbstractDelombokMojo.html#L72> * The plugin dependencies. 73 <http://anthonywhitford.com/lombok.maven/lombok-maven-plugin/xref/lombok/maven/AbstractDelombokMojo.html#L73> */ 74 <http://anthonywhitford.com/lombok.maven/lombok-maven-plugin/xref/lombok/maven/AbstractDelombokMojo.html#L74> @Parameter(property="plugin.artifacts", required=true, readonly=true) 75 <http://anthonywhitford.com/lombok.maven/lombok-maven-plugin/xref/lombok/maven/AbstractDelombokMojo.html#L75> private List<Artifact> pluginArtifacts; You can see an example here: http://anthonywhitford.com/lombok.maven/lombok-maven-plugin/xref/lombok/maven/AbstractDelombokMojo.html#L75 <http://anthonywhitford.com/lombok.maven/lombok-maven-plugin/xref/lombok/maven/AbstractDelombokMojo.html#L75> Hope this helps, Anthony > On Sep 18, 2019, at 10:58 PM, Anthony Whitford <[email protected]> wrote: > > Your code is logging the artifacts related to the project (not the plugin). > > Your plugin’s dependencies are not dynamic. > From your plugin’s project, you can run: mvn dependency:tree > > Or maybe you can look at the Plugin’s Site documentation. For example: > http://anthonywhitford.com/lombok.maven/lombok-maven-plugin/dependencies.html > <http://anthonywhitford.com/lombok.maven/lombok-maven-plugin/dependencies.html> > > Hope this helps, > > Anthony > > >> On Sep 18, 2019, at 5:48 AM, jason peck <[email protected]> wrote: >> >> Thanks. Is there a way to directly get the list of plugin dependencies from >> within the custom plugin mojo when run in a project? The following all >> return empty sets when called from the plugin execute() method in that >> scenario: >> >> getLog().info( "getCompileArtifacts " + project.getCompileArtifacts() ); >> getLog().info( "getTestArtifacts " + project.getTestArtifacts() ); >> getLog().info( "getRuntimeArtifacts " + project.getRuntimeArtifacts() ); >> getLog().info( "getSystemArtifacts " + project.getSystemArtifacts() ); >> getLog().info( "getDependencyArtifacts " + project.getDependencyArtifacts() >> ); >> getLog().info( "getDependencies " + project.getDependencies() ); >> >> I do see getClass().getClassLoader() populated with the plugin deps, though >> I'd rather not parse that. >> >> Thanks, >> J >> >> On 2019/09/18 05:58:50, Anthony Whitford <[email protected]> wrote: >>> Plugins have their own dependencies that pertain to the execution of the >> plugin goals. When you declare a plugin to use in your project, you don’t >> need to mention its dependencies — the Plugin’s POM does that.> >>> >>> >>>> On Sep 17, 2019, at 2:26 PM, jason peck <[email protected]> wrote:> >>>>> >>>> Apologies in advance if this is obvious.> >>>>> >>>> Let's say I create a custom plugin. The plugin has a> >>>> <dependency></dependency>. When I use the custom plugin in another> >>>> project's pom file, do I need to also specify the >> <dependency></dependency>> >>>> in the project's pom file? Is there anyway to automatically include >> that> >>>> dependency so the user of the plugin doesn't have to do so themselves, >> or> >>>> is that bad practice?> >>>>> >>>> Thanks!> >>>> J> >>> >>> >>> ---------------------------------------------------------------------> >>> To unsubscribe, e-mail: [email protected]> >>> For additional commands, e-mail: [email protected]> >>> >>> >
