Author: svn-site-role
Date: Fri Feb 17 23:05:21 2023
New Revision: 1907723

Log:
Site checkin for project Apache Maven Site

Modified:
    maven/website/content/guides/plugin/guide-java-plugin-development.html
    maven/website/content/maven-site-1.0-site.jar

Modified: maven/website/content/guides/plugin/guide-java-plugin-development.html
==============================================================================
--- maven/website/content/guides/plugin/guide-java-plugin-development.html 
(original)
+++ maven/website/content/guides/plugin/guide-java-plugin-development.html Fri 
Feb 17 23:05:21 2023
@@ -154,52 +154,56 @@ KIND, either express or implied.  See th
 specific language governing permissions and limitations
 under the License.
 -->
-<section><section>
-<h2>Introduction</h2>
-<p>This guide is intended to assist users in developing Java plugins for 
Maven.</p>
+<section>
+<h1>Introduction</h1>
+<p>This guide is intended to assist users in developing Java plugins for 
Maven.</p><!-- TODO replace by TOC macro after 
https://issues.apache.org/jira/browse/DOXIA-696 -->
+
+<ul>
+
+<li><a 
href="#important-notice-plugin-naming-convention-and-apache-maven-trade">Important
 Notice: Plugin Naming Convention and Apache Maven Trademark</a></li>
+<li><a href="#your-first-plugin">Your First Plugin</a>
+<ul>
+
+<li><a href="#your-first-mojo">Your First Mojo</a></li>
+<li><a href="#a-simple-mojo">A Simple Mojo</a></li>
+<li><a href="#project-definition">Project Definition</a></li>
+<li><a href="#building-a-plugin">Building a Plugin</a></li>
+</ul></li>
+<li><a href="#executing-your-first-mojo">Executing Your First Mojo</a>
+<ul>
+
+<li><a href="#shortening-the-command-line">Shortening the Command Line</a></li>
+<li><a href="#attaching-the-mojo-to-the-build-lifecycle">Attaching the Mojo to 
the Build Lifecycle</a></li>
+</ul></li>
+<li><a href="#mojo-archetype">Mojo archetype</a></li>
+<li><a href="#parameters">Parameters</a>
 <ul>
 
-<li>
-<p><a 
href="Important_Notice:_Plugin_Naming_Convention_and_Apache_Maven_Trademark">Important
 Notice: Plugin Naming Convention and Apache Maven Trademark</a></p></li>
-<li>
-<p><a href="Your_First_Plugin">Your First Plugin</a></p></li>
-<li>
-<p><a href="Your_First_Mojo">Your First Mojo</a></p></li>
-<li>
-<p><a href="A_Simple_Mojo">A Simple Mojo</a></p></li>
-<li>
-<p><a href="Project_Definition">Project Definition</a></p></li>
-<li>
-<p><a href="Building_a_Plugin">Building a Plugin</a></p></li>
-<li>
-<p><a href="Executing_Your_First_Mojo">Executing Your First Mojo</a></p></li>
-<li>
-<p><a href="Shortening_the_Command_Line">Shortening the Command 
Line</a></p></li>
-<li>
-<p><a href="Attaching_the_Mojo_to_the_Build_Lifecycle">Attaching the Mojo to 
the Build Lifecycle</a></p></li>
-<li>
-<p><a href="Mojo_archetype">Mojo archetype</a></p></li>
-<li>
-<p><a href="Parameters">Parameters</a></p></li>
-<li>
-<p><a href="Defining_Parameters_Within_a_Mojo">Defining Parameters Within a 
Mojo</a></p></li>
-<li>
-<p><a href="Configuring_Parameters_in_a_Project">Configuring Parameters in a 
Project</a></p></li>
-<li>
-<p><a href="Using_Setters">Using Setters</a></p></li>
-<li>
-<p><a href="Resources">Resources</a></p></li>
+<li><a href="#defining-parameters-within-a-mojo">Defining Parameters Within a 
Mojo</a></li>
+<li><a href="#configuring-parameters-in-a-project">Configuring Parameters in a 
Project</a></li>
+</ul></li>
+<li><a href="#using-setters">Using Setters</a></li>
+<li><a href="#resources">Resources</a></li>
 </ul><section>
-<h3>Important Notice: <a href="../mini/guide-naming-conventions.html">Plugin 
Naming Convention and Apache Maven Trademark</a></h3>
+<h2>Important Notice: <a href="../mini/guide-naming-conventions.html">Plugin 
Naming Convention and Apache Maven Trademark</a></h2>
 <p>You will typically name your plugin 
<code>&lt;yourplugin&gt;-maven-plugin</code>.</p>
-<p>Calling it <code>maven-&lt;yourplugin&gt;-plugin</code> (note 
&#x201c;Maven&#x201d; is at the beginning of the plugin name) is 
<strong>strongly discouraged</strong> since it's a <strong>reserved naming 
pattern for official Apache Maven plugins maintained by the Apache Maven 
team</strong> with groupId <code>org.apache.maven.plugins</code>. Using this 
naming pattern is an infringement of the Apache Maven 
Trademark.</p></section><section>
-<h3>Your First Plugin</h3>
-<p>In this section we will build a simple plugin with one goal which takes no 
parameters and simply displays a message on the screen when run. Along the way, 
we will cover the basics of setting up a project to create a plugin, the 
minimal contents of a Java mojo which will define goal code, and a couple ways 
to execute the mojo.</p><section>
-<h4>Your First Mojo</h4>
-<p>At its simplest, a Java mojo consists simply of a single class representing 
one plugin's goal. There is no requirement for multiple classes like EJBs, 
although a plugin which contains a number of similar mojos is likely to use an 
abstract superclass for the mojos to consolidate code common to all mojos.</p>
-<p>When processing the source tree to find mojos, <a 
href="/plugin-tools/"><code>plugin-tools</code></a> looks for classes with 
either <code>@Mojo</code> Java 5 annotation or 
&#x201c;<code>goal</code>&#x201d; javadoc annotation. Any class with this 
annotation are included in the plugin configuration file.</p><section>
-<h5>A Simple Mojo</h5>
-<p>Listed below is a simple mojo class which has no parameters. This is about 
as simple as a mojo can be. After the listing is a description of the various 
parts of the source.</p>
+<p>Calling it <code>maven-&lt;yourplugin&gt;-plugin</code> (note 
&#x201c;Maven&#x201d; is at the beginning of the plugin name)
+is <strong>strongly discouraged</strong> since it's a <strong>reserved naming 
pattern for official Apache Maven plugins maintained by the Apache Maven 
team</strong>
+with groupId <code>org.apache.maven.plugins</code>.</p>
+<p>Using this naming pattern is an infringement of the Apache Maven 
Trademark.</p></section><section>
+<h2>Your First Plugin</h2>
+<p>In this section we will build a simple plugin with one goal which takes no 
parameters and simply displays a message on the screen when run.
+Along the way, we will cover the basics of setting up a project to create a 
plugin, the minimal contents of a Java mojo which will define goal code,
+and a couple ways to execute the mojo.</p><section>
+<h3>Your First Mojo</h3>
+<p>At its simplest, a Java mojo consists simply of a single class representing 
one plugin's goal.
+There is no requirement for multiple classes like EJBs, although a plugin 
which contains a number of similar mojos is likely to use an abstract superclass
+for the mojos to consolidate code common to all mojos.</p>
+<p>When processing the source tree to find mojos, <a 
href="/plugin-tools/"><code>plugin-tools</code></a> looks for classes with 
either <code>@Mojo</code> annotation.
+Any class with this annotation are included in the plugin configuration 
file.</p></section><section>
+<h3>A Simple Mojo</h3>
+<p>Listed below is a simple mojo class which has no parameters. This is about 
as simple as a mojo can be.
+After the listing is a description of the various parts of the source.</p>
 
 <div class="source"><pre class="prettyprint linenums"><code>package 
sample.plugin;
 
@@ -211,48 +215,47 @@ import org.apache.maven.plugins.annotati
  * Says &quot;Hi&quot; to the user.
  *
  */
-@Mojo( name = &quot;sayhi&quot;)
-public class GreetingMojo extends AbstractMojo
-{
-    public void execute() throws MojoExecutionException
-    {
+@Mojo(name = &quot;sayhi&quot;)
+public class GreetingMojo extends AbstractMojo {
+
+    public void execute() throws MojoExecutionException {
         getLog().info( &quot;Hello, world.&quot; );
     }
 }
 </code></pre></div>
 <ul>
 
-<li>
-<p>The class <code>org.apache.maven.plugin.AbstractMojo</code> provides most 
of the infrastructure required to implement a mojo except for the 
<code>execute</code> method.</p></li>
-<li>
-<p>The annotation &#x201c;<code>@Mojo</code>&#x201d; is required and control 
how and when the mojo is executed.</p></li>
-<li>
-<p>The <code>execute</code> method can throw two exceptions:</p></li>
-<li>
-<p><code>org.apache.maven.plugin.MojoExecutionException</code> if an 
unexpected problem occurs. Throwing this exception causes a &#x201c;BUILD 
ERROR&#x201d; message to be displayed.</p></li>
-<li>
-<p><code>org.apache.maven.plugin.MojoFailureException</code> if an expected 
problem (such as a compilation failure) occurs. Throwing this exception causes 
a &#x201c;BUILD FAILURE&#x201d; message to be displayed.</p></li>
-<li>
-<p>The <code>getLog</code> method (defined in <code>AbstractMojo</code>) 
returns a log4j-like logger object which allows plugins to create messages at 
levels of &#x201c;debug&#x201d;, &#x201c;info&#x201d;, &#x201c;warn&#x201d;, 
and &#x201c;error&#x201d;. This logger is the accepted means to display 
information to the user. Please have a look at the section <a 
href="../../plugin-developers/common-bugs.html#Retrieving_the_Mojo_Logger">Retrieving
 the Mojo Logger</a> for a hint on its proper usage.</p></li>
+<li>The class <code>org.apache.maven.plugin.AbstractMojo</code> provides most 
of the infrastructure required to implement a mojo except for the 
<code>execute</code> method.</li>
+<li>The annotation &#x201c;<code>@Mojo</code>&#x201d; is required and control 
how and when the mojo is executed.</li>
+<li>The <code>execute</code> method can throw an exception:
+<ul>
+
+<li><code>org.apache.maven.plugin.MojoExecutionException</code> if an 
unexpected problem occurs. Throwing this exception causes a &#x201c;BUILD 
FAILURE&#x201d; message to be displayed.</li>
+</ul></li>
+<li>The <code>getLog</code> method (defined in <code>AbstractMojo</code>) 
returns a log4j-like logger object which allows plugins to create messages at 
levels of &#x201c;debug&#x201d;, &#x201c;info&#x201d;, &#x201c;warn&#x201d;, 
and &#x201c;error&#x201d;.
+This logger is the accepted means to display information to the user. Please 
have a look at the section <a 
href="../../plugin-developers/common-bugs.html#retrieving-the-mojo-logger">Retrieving
 the Mojo Logger</a> for a hint on its proper usage.</li>
 </ul>
-<p>All Mojo annotations are described by the <a 
href="../../developers/mojo-api-specification.html#The_Descriptor_and_Annotations">Mojo
 API Specification</a>.</p></section></section><section>
-<h4>Project Definition</h4>
+<p>All Mojo annotations are described by the <a 
href="../../developers/mojo-api-specification.html#The_Descriptor_and_Annotations">Mojo
 API Specification</a>.</p></section><section>
+<h3>Project Definition</h3>
 <p>Once the mojos have been written for the plugin, it is time to build the 
plugin. To do this properly, the project's descriptor needs to have a number of 
settings set properly:</p>
 <table class="table table-striped">
 <thead>
 <tr class="a">
-<th><code>groupId</code></th>
-<th>This is the group ID for the plugin, and should match the common prefix to 
the packages used by the mojos</th></tr></thead><tbody>
+<th> </th>
+<th> </th></tr></thead><tbody>
 <tr class="b">
+<td><code>groupId</code></td>
+<td>This is the group ID for the plugin, and should match the common prefix to 
the packages used by the mojos</td></tr>
+<tr class="a">
 <td><code>artifactId</code></td>
 <td>This is the name of the plugin</td></tr>
-<tr class="a">
+<tr class="b">
 <td><code>version</code></td>
 <td>This is the version of the plugin</td></tr>
-<tr class="b">
-<td><code>packaging</code></td>
-<td>This should be set to &#x201c;<code>maven-plugin</code>&#x201d;</td></tr>
 <tr class="a">
+<td><code>packaging</code></td>
+<td>This must be set to &#x201c;<code>maven-plugin</code>&#x201d;</td></tr>
+<tr class="b">
 <td><code>dependencies</code></td>
 <td>A dependency must be declared to the Maven Plugin Tools API to resolve 
&#x201c;<code>AbstractMojo</code>&#x201d; and related classes</td></tr></tbody>
 </table>
@@ -268,7 +271,11 @@ public class GreetingMojo extends Abstra
   &lt;packaging&gt;maven-plugin&lt;/packaging&gt;
 
   &lt;name&gt;Sample Parameter-less Maven Plugin&lt;/name&gt;
-
+  
+  &lt;properties&gt;
+    &lt;maven-plugin-tools.version&gt;3.7.1&lt;/maven-plugin-tools.version&gt;
+  &lt;/properties&gt;
+  
   &lt;dependencies&gt;
     &lt;dependency&gt;
       &lt;groupId&gt;org.apache.maven&lt;/groupId&gt;
@@ -281,41 +288,65 @@ public class GreetingMojo extends Abstra
     &lt;dependency&gt;
       &lt;groupId&gt;org.apache.maven.plugin-tools&lt;/groupId&gt;
       &lt;artifactId&gt;maven-plugin-annotations&lt;/artifactId&gt;
-      &lt;version&gt;3.4&lt;/version&gt;
+      &lt;version&gt;${maven-plugin-tools.version}&lt;/version&gt;
       &lt;scope&gt;provided&lt;/scope&gt;
     &lt;/dependency&gt;
   &lt;/dependencies&gt;
+  
+  &lt;build&gt;
+    &lt;pluginManagement&gt;
+      &lt;plugin&gt;
+        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
+        &lt;artifactId&gt;maven-plugin-plugin&lt;/artifactId&gt;
+        &lt;version&gt;${maven-plugin-tools.version}&lt;/version&gt;
+        &lt;executions&gt;
+          &lt;execution&gt;
+            &lt;id&gt;help-mojo&lt;/id&gt;
+            &lt;goals&gt;
+              &lt;!-- good practice is to generate help mojo for plugin --&gt;
+              &lt;goal&gt;helpmojo&lt;/goal&gt;
+            &lt;/goals&gt;
+          &lt;/execution&gt;
+        &lt;/executions&gt;
+      &lt;/plugin&gt;
+    &lt;/pluginManagement&gt;
+  &lt;/build&gt;
 &lt;/project&gt;
 </code></pre></div></section><section>
-<h4>Building a Plugin</h4>
+<h3>Building a Plugin</h3>
 <p>There are few plugins goals bound to the standard build lifecycle defined 
with the <code>maven-plugin</code> packaging:</p>
 <table class="table table-striped">
 <thead>
 <tr class="a">
-<th><code>compile</code></th>
-<th>Compiles the Java code for the plugin</th></tr></thead><tbody>
+<th> </th>
+<th> </th></tr></thead><tbody>
 <tr class="b">
+<td><code>compile</code></td>
+<td>Compiles the Java code for the plugin</td></tr>
+<tr class="a">
 <td><code>process-classes</code></td>
 <td>Extracts data to build the <a 
href="/ref/current/maven-plugin-api/plugin.html">plugin descriptor</a></td></tr>
-<tr class="a">
+<tr class="b">
 <td><code>test</code></td>
 <td>Runs the plugin's unit tests</td></tr>
-<tr class="b">
+<tr class="a">
 <td><code>package</code></td>
 <td>Builds the plugin jar</td></tr>
-<tr class="a">
+<tr class="b">
 <td><code>install</code></td>
 <td>Installs the plugin jar in the local repository</td></tr>
-<tr class="b">
+<tr class="a">
 <td><code>deploy</code></td>
 <td>Deploys the plugin jar to the remote repository</td></tr></tbody>
 </table>
 
-<p>For more details, you can look at <a 
href="/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_maven-plugin_packaging">detailed
 bindings for <code>maven-plugin</code> packaging</a>.</p></section><section>
-<h4>Executing Your First Mojo</h4>
-<p>The most direct means of executing your new plugin is to specify the plugin 
goal directly on the command line. To do this, you need to configure the 
<code>hello-maven-plugin</code> plugin in you project:</p>
+<p>For more details, you can look at <a 
href="/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_maven-plugin_packaging">detailed
 bindings for <code>maven-plugin</code> 
packaging</a>.</p></section></section><section>
+<h2>Executing Your First Mojo</h2>
+<p>The most direct means of executing your new plugin is to specify the plugin 
goal directly on the command line.
+To do this, you need to configure the <code>hello-maven-plugin</code> plugin 
in you project:</p>
 
-<div class="source"><pre class="prettyprint linenums"><code>...
+<div class="source"><pre class="prettyprint linenums"><code>&lt;project&gt;
+...
   &lt;build&gt;
     &lt;pluginManagement&gt;
       &lt;plugins&gt;
@@ -328,6 +359,7 @@ public class GreetingMojo extends Abstra
     &lt;/pluginManagement&gt;
   &lt;/build&gt;
 ...
+&lt;/project&gt;
 </code></pre></div>
 <p>And, you need to specify a fully-qualified goal in the form of:</p>
 
@@ -335,24 +367,26 @@ public class GreetingMojo extends Abstra
 </code></pre></div>
 <p>For example, to run the simple mojo in the sample plugin, you would enter 
&#x201c;<code>mvn 
sample.plugin:hello-maven-plugin:1.0-SNAPSHOT:sayhi</code>&#x201d; on the 
command line.</p>
 <p><strong>Tips</strong>: <code>version</code> is not required to run a 
standalone goal.</p><section>
-<h5>Shortening the Command Line</h5>
+<h3>Shortening the Command Line</h3>
 <p>There are several ways to reduce the amount of required typing:</p>
 <ul>
 
-<li>
-<p>If you need to run the latest version of a plugin installed in your local 
repository, you can omit its version number. So just use &#x201c;<code>mvn 
sample.plugin:hello-maven-plugin:sayhi</code>&#x201d; to run your 
plugin.</p></li>
-<li>
-<p>You can assign a shortened prefix to your plugin, such as <code>mvn 
hello:sayhi</code>. This is done automatically if you follow the convention of 
using <code>${prefix}-maven-plugin</code> (or 
<code>maven-${prefix}-plugin</code> if the plugin is part of the Apache Maven 
project). You may also assign one through additional configuration - for more 
information see <a 
href="../introduction/introduction-to-plugin-prefix-mapping.html">Introduction 
to Plugin Prefix Mapping</a>.</p></li>
-<li>
-<p>Finally, you can also add your plugin's groupId to the list of groupIds 
searched by default. To do this, you need to add the following to your 
<code>${user.home}/.m2/settings.xml</code> file:</p></li>
+<li>If you need to run the latest version of a plugin installed in your local 
repository, you can omit its version number.
+So just use &#x201c;<code>mvn 
sample.plugin:hello-maven-plugin:sayhi</code>&#x201d; to run your plugin.</li>
+<li>You can assign a shortened prefix to your plugin, such as <code>mvn 
hello:sayhi</code>.
+This is done automatically if you follow the convention of using 
<code>${prefix}-maven-plugin</code>
+(or <code>maven-${prefix}-plugin</code> if the plugin is part of the Apache 
Maven project).
+You may also assign one through additional configuration - for more 
information see <a 
href="../introduction/introduction-to-plugin-prefix-mapping.html">Introduction 
to Plugin Prefix Mapping</a>.</li>
+<li>Finally, you can also add your plugin's groupId to the list of groupIds 
searched by default.
+To do this, you need to add the following to your 
<code>${user.home}/.m2/settings.xml</code> file:</li>
 </ul>
 
 <div class="source"><pre class="prettyprint 
linenums"><code>&lt;pluginGroups&gt;
   &lt;pluginGroup&gt;sample.plugin&lt;/pluginGroup&gt;
 &lt;/pluginGroups&gt;
 </code></pre></div>
-<p>At this point, you can run the mojo with &#x201c;<code>mvn 
hello:sayhi</code>&#x201d;.</p></section><section>
-<h5>Attaching the Mojo to the Build Lifecycle</h5>
+<p>At this point, you can run the mojo with <code>mvn 
hello:sayhi</code>.</p></section><section>
+<h3>Attaching the Mojo to the Build Lifecycle</h3>
 <p>You can also configure your plugin to attach specific goals to a particular 
phase of the build lifecycle. Here is an example:</p>
 
 <div class="source"><pre class="prettyprint linenums"><code>  &lt;build&gt;
@@ -381,8 +415,8 @@ public class GreetingMojo extends Abstra
     &lt;/plugins&gt;
   &lt;/build&gt;
 </code></pre></div>
-<p>This causes the simple mojo to be executed whenever Java code is compiled. 
For more information on binding a mojo to phases in the lifecycle, please refer 
to the <a href="../introduction/introduction-to-the-lifecycle.html">Build 
Lifecycle</a> document.</p></section></section></section><section>
-<h3>Mojo archetype</h3>
+<p>This causes the simple mojo to be executed whenever Java code is compiled. 
For more information on binding a mojo to phases in the lifecycle, please refer 
to the <a href="../introduction/introduction-to-the-lifecycle.html">Build 
Lifecycle</a> document.</p></section></section><section>
+<h2>Mojo archetype</h2>
 <p>To create a new plugin project, you could using the Mojo <a 
href="../introduction/introduction-to-archetypes.html">archetype</a> with the 
following command line:</p>
 
 <div class="source"><pre class="prettyprint linenums"><code>mvn 
archetype:generate \
@@ -391,17 +425,16 @@ public class GreetingMojo extends Abstra
   -DarchetypeGroupId=org.apache.maven.archetypes \
   -DarchetypeArtifactId=maven-archetype-plugin
 </code></pre></div></section><section>
-<h3>Parameters</h3>
+<h2>Parameters</h2>
 <p>It is unlikely that a mojo will be very useful without parameters. 
Parameters provide a few very important functions:</p>
 <ul>
 
-<li>
-<p>It provides hooks to allow the user to adjust the operation of the plugin 
to suit their needs.</p></li>
-<li>
-<p>It provides a means to easily extract the value of elements from the POM 
without the need to navigate the objects.</p></li>
+<li>It provides hooks to allow the user to adjust the operation of the plugin 
to suit their needs.</li>
+<li>It provides a means to easily extract the value of elements from the POM 
without the need to navigate the objects.</li>
 </ul><section>
-<h4>Defining Parameters Within a Mojo</h4>
-<p>Defining a parameter is as simple as creating an instance variable in the 
mojo and adding the proper annotations. Listed below is an example of a 
parameter for the simple mojo:</p>
+<h3>Defining Parameters Within a Mojo</h3>
+<p>Defining a parameter is as simple as creating an instance variable in the 
mojo and adding the proper annotations.
+Listed below is an example of a parameter for the simple mojo:</p>
 
 <div class="source"><pre class="prettyprint linenums"><code>    /**
      * The greeting to display.
@@ -409,9 +442,15 @@ public class GreetingMojo extends Abstra
     @Parameter( property = &quot;sayhi.greeting&quot;, defaultValue = 
&quot;Hello World!&quot; )
     private String greeting;
 </code></pre></div>
-<p>The portion before the annotations is the description of the parameter. The 
<code>parameter</code> annotation identifies the variable as a mojo parameter. 
The <code>defaultValue</code> parameter of the annotation defines the default 
value for the variable. This value can include expressions which reference the 
project, such as &#x201c;<code>${project.version}</code>&#x201d; (more can be 
found in the <a 
href="/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html">&#x201c;Parameter
 Expressions&#x201d; document</a>). The <code>property</code> parameter can be 
used to allow configuration of the mojo parameter from the command line by 
referencing a system property that the user sets via the <code>-D</code> 
option.</p></section><section>
-<h4>Configuring Parameters in a Project</h4>
-<p>Configuring the parameter values for a plugin is done in a Maven project 
within the <code>pom.xml</code> file as part of defining the plugin in the 
project. An example of configuring a plugin:</p>
+<p>The portion before the annotations is the description of the parameter.</p>
+<p>The <code>@Parameter</code> annotation identifies the variable as a mojo 
parameter.</p>
+<p>The <code>defaultValue</code> parameter of the annotation defines the 
default value for the variable.
+This value can include expressions which reference the project, such as 
&#x201c;<code>${project.version}</code>&#x201d;
+(more can be found in the <a 
href="/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html">&#x201c;Parameter
 Expressions&#x201d; document</a>).</p>
+<p>The <code>property</code> parameter can be used to allow configuration of 
the mojo parameter from the command line by referencing a property that the 
user sets via the <code>-D</code> option.</p></section><section>
+<h3>Configuring Parameters in a Project</h3>
+<p>Configuring the parameter values for a plugin is done in a Maven project 
within the <code>pom.xml</code> file as part of defining the plugin in the 
project.
+An example of configuring a plugin:</p>
 
 <div class="source"><pre class="prettyprint linenums"><code>&lt;plugin&gt;
   &lt;groupId&gt;sample.plugin&lt;/groupId&gt;
@@ -424,53 +463,58 @@ public class GreetingMojo extends Abstra
 </code></pre></div>
 <p>In the configuration section, the element name 
(&#x201c;<code>greeting</code>&#x201d;) is the parameter name and the contents 
of the element (&#x201c;<code>Welcome</code>&#x201d;) is the value to be 
assigned to the parameter.</p>
 <p><strong>Note</strong>: More details can be found in the <a 
href="../mini/guide-configuring-plugins.html">Guide to Configuring 
Plugins</a>.</p></section></section><section>
-<h3>Using Setters</h3>
-<p>You are not restricted to using private field mapping which is good if you 
are trying to make you Mojos resuable outside the context of Maven. Using the 
example above we could name our private fields using the underscore convention 
and provide setters that the configuration mapping mechanism can use. So our 
Mojo would look like the following:</p>
+<h2>Using Setters</h2>
+<p>You are not restricted to using private field mapping which is good if you 
are trying to make you Mojos reusable outside the context of Maven.</p>
+<p>Using the example above we could define public setters methods that the 
configuration mapping mechanism can use.</p>
+<p>You can also add <code>@Parameter</code> annotation on setter method (from 
version 3.7.0 of <code>plugin-tools</code>)</p>
+<p>So our Mojo would look like the following:</p>
 
 <div class="source"><pre class="prettyprint linenums"><code>
-public class MyQueryMojo
-    extends AbstractMojo
-{
-    @Parameter(property=&quot;url&quot;)
+public class MyQueryMojo extends AbstractMojo {
+
+    // provide name for non matching field and setter name
+    @Parameter(name=&quot;url&quot;, property=&quot;url&quot;)
     private String _url;
 
     @Parameter(property=&quot;timeout&quot;)
-    private int _timeout;
+    private int timeout;
 
-    @Parameter(property=&quot;options&quot;)
-    private String[] _options;
+    private String option0;
+    private String option1;
 
-    public void setUrl( String url )
-    {
+    public void setUrl(String url) {
         _url = url;
     }
 
-    public void setTimeout( int timeout )
-    {
-        _timeout = timeout;
+    public void setTimeout(int timeout) {
+        this.timeout = timeout;
     }
 
-    public void setOptions( String[] options )
-    {
-        _options = options;
+    @Parameter(property=&quot;options&quot;)
+    public void setOptions(String[] options) {
+        // we can do something more with provided parameter
+        this.option0 = options[0];
+        this.option1 = options[1];
     }
 
-    public void execute()
-        throws MojoExecutionException
-    {
+    public void execute() throws MojoExecutionException {
         ...
     }
 }
 
 </code></pre></div>
-<p>Note the specification of the property name for each parameter which tells 
Maven what setter and getter to use when the field's name does not match the 
intended name of the parameter in the plugin 
configuration.</p></section><section>
-<h3>Resources</h3>
-<p>1 <a href="../../developers/mojo-api-specification.html">Mojo 
Documentation</a>: Mojo API, Mojo annotations</p>
-<p>1 <a href="/shared/maven-plugin-testing-harness/">Maven Plugin Testing 
Harness</a>: Testing framework for your Mojos.</p>
-<p>1 <a href="https://codehaus-plexus.github.io/"; 
class="externalLink">Plexus</a>: The IoC container used by Maven.</p>
-<p>1 <a href="https://codehaus-plexus.github.io/plexus-utils/"; 
class="externalLink">Plexus Common Utilities</a>: Set of utilities classes 
useful for Mojo development.</p>
-<p>1 <a href="http://commons.apache.org/io/"; class="externalLink">Commons 
IO</a>: Set of utilities classes useful for file/path handling.</p>
-<p>1 <a href="../../plugin-developers/common-bugs.html">Common Bugs and 
Pitfalls</a>: Overview of problematic coding 
patterns.</p></section></section></section>
+<p>Note the specification of the property name for each parameter which tells 
Maven
+what setter and getter to use when the field's name does not match the 
intended name of the parameter in the plugin 
configuration.</p></section><section>
+<h2>Resources</h2>
+<ol style="list-style-type: decimal">
+
+<li><a href="../../developers/mojo-api-specification.html">Mojo 
Documentation</a>: Mojo API, Mojo annotations</li>
+<li><a href="/shared/maven-plugin-testing-harness/">Maven Plugin Testing 
Harness</a>: Testing framework for your Mojos.</li>
+<li><a href="https://codehaus-plexus.github.io/"; 
class="externalLink">Plexus</a>: The IoC container used by Maven.</li>
+<li><a href="https://codehaus-plexus.github.io/plexus-utils/"; 
class="externalLink">Plexus Common Utilities</a>: Set of utilities classes 
useful for Mojo development.</li>
+<li><a href="http://commons.apache.org/io/"; class="externalLink">Commons 
IO</a>: Set of utilities classes useful for file/path handling.</li>
+<li><a href="../../plugin-developers/common-bugs.html">Common Bugs and 
Pitfalls</a>: Overview of problematic coding patterns.</li>
+</ol></section></section>
         </main>
       </div>
     </div>

Modified: maven/website/content/maven-site-1.0-site.jar
==============================================================================
Binary files - no diff available.


Reply via email to