<div dir="ltr">Hey Charles,<div><br></div><div>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.</div>
<div><br></div><div style>You could probably use that as an example :)</div><div style><br></div><div style>What do you think?</div><div style><br></div><div style>~Lincoln</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Fri, Apr 12, 2013 at 8:47 AM, Charles SALMON <span dir="ltr"><<a href="mailto:salmon.charles@gmail.com" target="_blank">salmon.charles@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div><div><div><div>Hello all,<br><br></div>I recently contributed to the forge project (FORGE-842) by adding the pluginManagement support to the mavenPluginFacet.<br></div><br></div>One question is still opened, which is the purpose of this post.<br>
</div>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.<br>
</div>Let's take the following example:<br><br><pre><span><build></span>
<span><pluginManagement></span>
<span><plugins></span>
<span><plugin></span>
         <span><artifactId></span>maven-compiler-plugin<span></artifactId></span>
         <span><version></span>2.0.2<span></version></span>
         <span><configuration></span>
         <span><source></span>1.6<span></source></span>
         <span><target></span>1.6<span></target></span>
         <span></configuration></span>
         <span></plugin></span>
<span></plugins></span>
<span></pluginManagement></span>
<span><plugins></span>
<span><plugin></span>
<span><artifactId></span>maven-compiler-plugin<span></artifactId></span>
<span></plugin></span>
<span></plugins></span>
<span></build></span></pre><br></div>Currently, a call to the <br><div style="border-width:1px"><div>
<pre>mavenPluginFacet.getPlugin(DependencyBuilder.create(<span>"org.apache.maven.plugins:maven-compiler-plugin"</span>)).getVersion()</pre>
will return a null value, because the version is not declared in the "//build/plugins/plugin" section.<br></div><div>Maven will, however, resolve the plugin by using the version and configuration of the maven-compiler-plugin declared in the "//build/pluginManagement/plugins" section.<br>
</div><div>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:<br></div><div>1. Compute the effective pom<br>
</div><div>2. Resolve the plugin properties<br><br></div><div>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 ?<br>
<br></div><div>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 ? ...<br>
<br></div><div>Based on your answers, I will create a FORGE issue and will try to implement the missing methods.<br><br></div><div>Thanks,<br></div><div>Charles.<br></div><div><br></div>
<div><br><br><br></div></div> </div>
<br>_______________________________________________<br>
forge-dev mailing list<br>
<a href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Lincoln Baxter, III<br><a href="http://ocpsoft.org" target="_blank">http://ocpsoft.org</a><br>
"Simpler is better."
</div>