<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 &quot;DependencyInstaller.java&quot;, 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">&lt;<a href="mailto:salmon.charles@gmail.com" target="_blank">salmon.charles@gmail.com</a>&gt;</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 &quot;pluginManagement&quot; section and used in a &quot;plugins&quot; section.<br>

</div>Let&#39;s take the following example:<br><br><pre><span>&lt;build&gt;</span>
    <span>&lt;pluginManagement&gt;</span>
      <span>&lt;plugins&gt;</span>
        <span>&lt;plugin&gt;</span>
                <span>&lt;artifactId&gt;</span>maven-compiler-plugin<span>&lt;/artifactId&gt;</span>
                <span>&lt;version&gt;</span>2.0.2<span>&lt;/version&gt;</span>
                <span>&lt;configuration&gt;</span>
                  <span>&lt;source&gt;</span>1.6<span>&lt;/source&gt;</span>
                  <span>&lt;target&gt;</span>1.6<span>&lt;/target&gt;</span>
                <span>&lt;/configuration&gt;</span>
            <span>&lt;/plugin&gt;</span>
      <span>&lt;/plugins&gt;</span>
    <span>&lt;/pluginManagement&gt;</span>
    <span>&lt;plugins&gt;</span>
      <span>&lt;plugin&gt;</span>
        <span>&lt;artifactId&gt;</span>maven-compiler-plugin<span>&lt;/artifactId&gt;</span>
      <span>&lt;/plugin&gt;</span>
    <span>&lt;/plugins&gt;</span>
<span>&lt;/build&gt;</span></pre><br></div>Currently, a call to the <br><div style="border-width:1px"><div>
<pre>mavenPluginFacet.getPlugin(DependencyBuilder.create(<span>&quot;org.apache.maven.plugins:maven-compiler-plugin&quot;</span>)).getVersion()</pre>
will return a null value, because the version is not declared in the &quot;//build/plugins/plugin&quot; section.<br></div><div>Maven will, however, resolve the plugin by using the version and configuration of the maven-compiler-plugin declared in the &quot;//build/pluginManagement/plugins&quot; 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 &quot;addPlugin&quot; 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>
&quot;Simpler is better.&quot;
</div>