[forge-dev] MavenPluginFacet enhancement: smart plugin resolution

Lincoln Baxter, III lincolnbaxter at gmail.com
Tue Apr 16 14:19:34 EDT 2013

Hey Charles,

I think this is a really good and very important idea. Actually, we have
something called the "DependencyInstaller.java", which does this same thing
for Dependency instances. It would make sense to have something like a
MavenPluginInstaller as well, I think. So this idea is excellent.

You could probably use that as an example :)

What do you think?


On Fri, Apr 12, 2013 at 8:47 AM, Charles SALMON <salmon.charles at gmail.com>wrote:

> Hello all,
> I recently contributed to the forge project (FORGE-842) by adding the
> pluginManagement support to the mavenPluginFacet.
> One question is still opened, which is the purpose of this post.
> Basically, it is about a smart plugin resolution, ie having the plugin
> properties (artifactId, groupId, version,...) automatically resolved when a
> plugin is defined in a "pluginManagement" section and used in a "plugins"
> section.
> Let's take the following example:
> <build>
>     <pluginManagement>
>       <plugins>
>         <plugin>
> 	        <artifactId>maven-compiler-plugin</artifactId>
> 	        <version>2.0.2</version>
> 	        <configuration>
> 	          <source>1.6</source>
> 	          <target>1.6</target>
> 	        </configuration>
> 	    </plugin>
>       </plugins>
>     </pluginManagement>
>     <plugins>
>       <plugin>
>         <artifactId>maven-compiler-plugin</artifactId>
>       </plugin>
>     </plugins></build>
> Currently, a call to the
> mavenPluginFacet.getPlugin(DependencyBuilder.create("org.apache.maven.plugins:maven-compiler-plugin")).getVersion()
> will return a null value, because the version is not declared in the
> "//build/plugins/plugin" section.
> Maven will, however, resolve the plugin by using the version and
> configuration of the maven-compiler-plugin declared in the
> "//build/pluginManagement/plugins" section.
> Moreover, we should also note that the pluginManagement section will be,
> most of the time, declared in the parent pom, which makes the smart
> resolution as follow:
> 1. Compute the effective pom
> 2. Resolve the plugin properties
> My question is: based on the fact that similar implementation was done
> with Dependency and DependencyManagement sections (in the
> MavenDependencyFacet and DependencyInstaller), which methods should be
> implemented ?
> Following the same logic, we could also thing of a smart "addPlugin"
> method: what if I add a plugin that is already managed, with the same
> version of the managed plugin ? With some configuration element(s) being
> the same as the managed plugin ? ...
> Based on your answers, I will create a FORGE issue and will try to
> implement the missing methods.
> Thanks,
> Charles.
> _______________________________________________
> forge-dev mailing list
> forge-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev

Lincoln Baxter, III
"Simpler is better."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20130416/47e3c42e/attachment.html 

More information about the forge-dev mailing list