Modified: maven/website/content/guides/mini/guide-using-modello.html ============================================================================== --- maven/website/content/guides/mini/guide-using-modello.html (original) +++ maven/website/content/guides/mini/guide-using-modello.html Thu Feb 9 00:34:05 2023 @@ -2,7 +2,7 @@ <!-- - | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from content/apt/guides/mini/guide-using-modello.apt at 2023-02-08 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from content/markdown/guides/mini/guide-using-modello.md at 2023-02-09 | Rendered using Apache Maven Fluido Skin 1.11.1 --> <html xmlns="http://www.w3.org/1999/xhtml" lang=""> @@ -10,8 +10,7 @@ <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0-M4" /> - <meta name="author" content="Jason van Zyl -Hervé Boutemy" /> + <meta name="author" content="Jason van Zyl, Hervé Boutemy" /> <meta name="date" content="2009-03-01" /> <title>Maven – Guide to using Modello</title> <link rel="stylesheet" href="../../css/apache-maven-fluido-1.11.1.min.css" /> @@ -49,8 +48,8 @@ Hervé Boutemy" /> <ul class="breadcrumb"> <li class=""><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> <li class=""><a href="../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> - <li class="active ">Guide to using Modello <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-using-modello.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> - <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2023-02-08</li> + <li class="active ">Guide to using Modello <a href="https://github.com/apache/maven-site/tree/master/content/markdown/guides/mini/guide-using-modello.md"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2023-02-09</li> <li class="pull-right"><span class="divider">|</span> <a href="../../scm.html" title="Get Sources">Get Sources</a></li> <li class="pull-right"><a href="../../download.cgi" title="Download">Download</a></li> @@ -155,17 +154,43 @@ Hervé Boutemy" /> </div> </header> <main id="bodyColumn" class="span10" > -<section> -<h1>Guide to using Modello</h1> -<p><a class="externalLink" href="https://codehaus-plexus.github.io/modello/">Modello</a> is a tool for generating resources from a simple model. From a <a class="externalLink" href="https://codehaus-plexus.github.io/modello/modello.html">simple model</a> you can generate things like:</p> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<section><section> +<h2>Guide to using Modello</h2> +<p><a href="https://codehaus-plexus.github.io/modello/" class="externalLink">Modello</a> is a tool for generating resources from a simple model. From a <a href="https://codehaus-plexus.github.io/modello/modello.html" class="externalLink">simple model</a> you can generate things like:</p> <ul> -<li>Java sources</li> -<li>XML serialization code for the model</li> -<li>XML deserialization code for model</li> -<li>Model documentation</li> -<li>XSD</li></ul> + +<li> +<p>Java sources</p></li> +<li> +<p>XML serialization code for the model</p></li> +<li> +<p>XML deserialization code for model</p></li> +<li> +<p>Model documentation</p></li> +<li> +<p>XSD</p></li> +</ul> <p>A typical modello model looks like the following:</p> -<div class="source"><pre class="prettyprint linenums"><model xmlns="https://codehaus-plexus.github.io/MODELLO/1.8.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + +<div class="source"><pre class="prettyprint linenums"><code><model xmlns="https://codehaus-plexus.github.io/MODELLO/1.8.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://codehaus-plexus.github.io/MODELLO/1.8.0 https://codehaus-plexus.github.io/modello/xsd/modello-1.8.0.xsd" xml.namespace="https://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/${version}" xml.schemaLocation="http://maven.apache.org/xsd/archetype-descriptor-${version}.xsd"> @@ -388,9 +413,11 @@ Hervé Boutemy" /> </class> </classes> </model> -</pre></div> -<p>To utilize Modello, you would configure the <code>modello-maven-plugin</code> something like the following where you want to generate the Java sources for the model, the xpp3 serialization code and the xpp3 deserialization code (see <a class="externalLink" href="https://codehaus-plexus.github.io/modello/modello-plugins/modello-plugin-xpp3/">modello-plugin-xpp3</a> for more details):</p> -<div class="source"><pre class="prettyprint linenums"> + +</code></pre></div> +<p>To utilize Modello, you would configure the <code>modello-maven-plugin</code> something like the following where you want to generate the Java sources for the model, the xpp3 serialization code and the xpp3 deserialization code (see <a href="https://codehaus-plexus.github.io/modello/modello-plugins/modello-plugin-xpp3/" class="externalLink">modello-plugin-xpp3</a> for more details):</p> + +<div class="source"><pre class="prettyprint linenums"><code> <project> ... <build> @@ -423,7 +450,8 @@ Hervé Boutemy" /> </build> ... </project> -</pre></div></section> + +</code></pre></div></section></section> </main> </div> </div>
Modified: maven/website/content/guides/mini/guide-using-one-source-directory.html ============================================================================== --- maven/website/content/guides/mini/guide-using-one-source-directory.html (original) +++ maven/website/content/guides/mini/guide-using-one-source-directory.html Thu Feb 9 00:34:05 2023 @@ -2,7 +2,7 @@ <!-- - | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from content/apt/guides/mini/guide-using-one-source-directory.apt at 2023-02-08 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from content/markdown/guides/mini/guide-using-one-source-directory.md at 2023-02-09 | Rendered using Apache Maven Fluido Skin 1.11.1 --> <html xmlns="http://www.w3.org/1999/xhtml" lang=""> @@ -48,8 +48,8 @@ <ul class="breadcrumb"> <li class=""><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> <li class=""><a href="../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> - <li class="active ">Guide to Using Maven when You Can't Use the Conventions <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-using-one-source-directory.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> - <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2023-02-08</li> + <li class="active ">Guide to Using Maven when You Can't Use the Conventions <a href="https://github.com/apache/maven-site/tree/master/content/markdown/guides/mini/guide-using-one-source-directory.md"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2023-02-09</li> <li class="pull-right"><span class="divider">|</span> <a href="../../scm.html" title="Get Sources">Get Sources</a></li> <li class="pull-right"><a href="../../download.cgi" title="Download">Download</a></li> @@ -123,34 +123,59 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section> -<h1>Using Maven When You Can't Use the Conventions</h1> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<section><section> +<h2>Using Maven When You Can't Use the Conventions</h2> <p>There is a common misconception that Maven can't build a project that doesn't conform to certain directory structures or build practices. This often isn't the case. However, it is true that some Maven features or plugins (especially by third parties) may not work or work completely.</p> <p>This guide will help you set up Maven on your project when the directive from on high is to not change the existing layout, and detail some of the feature that you might miss when doing so.</p> <p>Use this as a last resort. There are good reasons why the defaults are the way they are, and we strongly recommend you use them if you can. It encourages consistency and means one less thing you ever need to worry about when starting a new project. There are more interesting things to do than change your layout for the sake of it. Hopefully having used any of these techniques you find that Maven proves itself capable, you will reconsider restructuring to address these issues.></p><section> -<h2>Using Multiple Source Directories</h2> +<h3>Using Multiple Source Directories</h3> <p>This occurs when you are producing a single JAR (or other artifact), and have several source directories with classes you want to include.</p><section> -<h3>Why isn't this recommended?</h3> -<p>...</p></section><section> -<h3>How do I do this?</h3> -<p>...</p></section><section> -<h3>What are the limitations?</h3> +<h4>Why isn't this recommended?</h4> +<p>…</p><!-- TODO --> +</section><section> +<h4>How do I do this?</h4> +<p>…</p><!-- TODO --> +</section><section> +<h4>What are the limitations?</h4> <p>There should be no limitations in this approach. Maven natively supports multiple source directories for the purposes of generated sources.</p></section></section><section> -<h2>Producing Multiple Unique JARs from a Single Source Directory</h2> +<h3>Producing Multiple Unique JARs from a Single Source Directory</h3> <p>As many people that complain about not being able to spread out their sources into multiple source directories seem to complain about not wanting to spread anything out, producing several unique artifacts from a single directory using includes and excludes.</p><section> -<h3>Why isn't this recommended?</h3> +<h4>Why isn't this recommended?</h4> <p>This practice can be confusing and risky.</p> <ul> -<li>You may end up building two JARs that include the same classes - this indicates that the common functionality should have been abstracted into a separate dependency.</li> -<li>You may end up introducing a dependency between the two JARs that you didn't realise, and often a circular dependency. This indicates that the classes are in the wrong JAR, or perhaps that everything should just be a single JAR.</li></ul></section><section> -<h3>How do I do this?</h3> + +<li> +<p>You may end up building two JARs that include the same classes - this indicates that the common functionality should have been abstracted into a separate dependency.</p></li> +<li> +<p>You may end up introducing a dependency between the two JARs that you didn't realise, and often a circular dependency. This indicates that the classes are in the wrong JAR, or perhaps that everything should just be a single JAR.</p></li> +</ul></section><section> +<h4>How do I do this?</h4> <p>You still should adhere to producing one artifact per POM, but this requires having multiple POMs, and hence multiple subdirectories. The positive to this is that these introduced directories won't change the layout of existing code, and will establish a future layout should you decide to separate.</p> <p>Here is an example of setting it up when there is a project with two JARs produced: <code>core</code> and <code>module</code>.</p> -<p>You might like to review the <a href="../getting-started/"> Getting Started Guide</a></p> +<p>You might like to review the <a href="../getting-started/">Getting Started Guide</a></p><!-- or {{{guide-multi-module.html} Guide to Using Multiple Modules}} --> + <p>that demonstrates how this is normally done in Maven, as it is quite similar.</p> <p>Your directory will look something like this:</p> -<div> -<pre>/ + +<div class="source"><pre class="prettyprint linenums"><code>/ +- pom.xml +- src/ +- main/ @@ -158,9 +183,11 @@ +- core/ +- Core.java +- module/ - +- Module.java</pre></div> + +- Module.java +</code></pre></div> <p>First, you set up your <code>pom.xml</code> at the top level not to produce anything, but to include the other modules we plan to create:</p> -<div class="source"><pre class="prettyprint linenums"><project> + +<div class="source"><pre class="prettyprint linenums"><code><project> <artifactId>my-parent</artifactId> <packaging>pom</packaging> ... @@ -168,9 +195,11 @@ <module>core</module> <module>module</module> </modules> -</project></pre></div> +</project> +</code></pre></div> <p>Next, the modules themselves are created. Here is the <code>core/pom.xml</code> file you should create. The one in the <code>module</code> subdirectory will be similar.</p> -<div class="source"><pre class="prettyprint linenums"><project> + +<div class="source"><pre class="prettyprint linenums"><code><project> <modelVersion>4.0.0</modelVersion> <parent> <groupId>my-groupId</groupId> @@ -193,11 +222,12 @@ </plugin> </plugins> </build> -</project></pre></div> +</project> +</code></pre></div> <p>In this example, the sources are found in the parent directory <code>../src/main/java</code>, and only Java files within a <code>core</code> package are included.</p> <p>The final result when building will look like this:</p> -<div> -<pre>/ + +<div class="source"><pre class="prettyprint linenums"><code>/ +- pom.xml +- src/ +- main/ @@ -213,14 +243,19 @@ +- module/ +- pom.xml +- target/ - +- my-module-1.0-SNAPSHOT.jar</pre></div></section><section> -<h3>What are the limitations?</h3> + +- my-module-1.0-SNAPSHOT.jar +</code></pre></div></section><section> +<h4>What are the limitations?</h4> <p>There is no universal inclusion/exclusion specification, so each plugin needs to be configured individually, and some might not have that capability. In particular, expect that site reports may include all sources, for example.</p></section></section><section> -<h2>Producing Multiple JARs from a single POM</h2> +<h3>Producing Multiple JARs from a single POM</h3> <p>Source directories aside, sometimes people desire to produce multiple JARs from a single POM. Depending on your use case, Maven can support this.</p> <ul> -<li>If you are looking to produce JARs that are different (i.e., they have their own dependencies and metadata), Maven doesn't support this. This usually is only needed when sharing a source directory for intrinsically different things, so the use case above applies instead.</li> -<li>If you are producing a JAR that is a derivative of the original (e.g., just a subset of classes, or the same JAR with debugging enabled), Maven supports this using profiles. See <a href="../introduction/introduction-to-profiles.html"> Introduction to Profiles</a> for more information.</li></ul></section></section> + +<li> +<p>If you are looking to produce JARs that are different (i.e., they have their own dependencies and metadata), Maven doesn't support this. This usually is only needed when sharing a source directory for intrinsically different things, so the use case above applies instead.</p></li> +<li> +<p>If you are producing a JAR that is a derivative of the original (e.g., just a subset of classes, or the same JAR with debugging enabled), Maven supports this using profiles. See <a href="../introduction/introduction-to-profiles.html">Introduction to Profiles</a> for more information.</p></li> +</ul></section></section></section> </main> </div> </div> Modified: maven/website/content/guides/mini/guide-using-toolchains.html ============================================================================== --- maven/website/content/guides/mini/guide-using-toolchains.html (original) +++ maven/website/content/guides/mini/guide-using-toolchains.html Thu Feb 9 00:34:05 2023 @@ -2,7 +2,7 @@ <!-- - | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from content/apt/guides/mini/guide-using-toolchains.apt at 2023-02-08 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from content/markdown/guides/mini/guide-using-toolchains.md at 2023-02-09 | Rendered using Apache Maven Fluido Skin 1.11.1 --> <html xmlns="http://www.w3.org/1999/xhtml" lang=""> @@ -10,9 +10,7 @@ <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0-M4" /> - <meta name="author" content="Maria Odea Ching -Dennis Lundberg -Karl Heinz Marbaise" /> + <meta name="author" content="Maria Odea Ching, Dennis Lundberg, Karl Heinz Marbaise" /> <meta name="date" content="2016-03-08" /> <title>Maven – Guide to Using Toolchains</title> <link rel="stylesheet" href="../../css/apache-maven-fluido-1.11.1.min.css" /> @@ -50,8 +48,8 @@ Karl Heinz Marbaise" /> <ul class="breadcrumb"> <li class=""><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> <li class=""><a href="../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> - <li class="active ">Guide to Using Toolchains <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-using-toolchains.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> - <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2023-02-08</li> + <li class="active ">Guide to Using Toolchains <a href="https://github.com/apache/maven-site/tree/master/content/markdown/guides/mini/guide-using-toolchains.md"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2023-02-09</li> <li class="pull-right"><span class="divider">|</span> <a href="../../scm.html" title="Get Sources">Get Sources</a></li> <li class="pull-right"><a href="../../download.cgi" title="Download">Download</a></li> @@ -156,83 +154,104 @@ Karl Heinz Marbaise" /> </div> </header> <main id="bodyColumn" class="span10" > -<section> -<h1>Guide to Using Toolchains</h1><section> -<h2>What is Toolchains?</h2> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<section><section> +<h2>Guide to Using Toolchains</h2><section> +<h3>What is Toolchains?</h3> <p>The Maven Toolchains provide a way for plugins to discover what JDK (or other tools) are to be used during the build, without the need to configure them in each plugin nor in every <code>pom.xml</code>, or forcing a precise location among every machine building the project.</p> <p>With Maven Toolchains applied to JDK toolchain, a project can now be built using a specific version of JDK independent from the one Maven is running with. Think how JDK versions can be set in IDEs like IDEA, NetBeans and Eclipse, or how you can compile with an older JDK from Maven running with a recent one.</p><section> -<h3>Prerequisites</h3> -<p>Toolchains will only work in Maven 2.0.9 and higher versions. For more details about its design and implementation, please see <a class="externalLink" href="http://cwiki.apache.org/confluence/display/MAVENOLD/Toolchains">Toolchains</a>.</p> +<h4>Prerequisites</h4> +<p>Toolchains will only work in Maven 2.0.9 and higher versions. For more details about its design and implementation, please see <a href="http://cwiki.apache.org/confluence/display/MAVENOLD/Toolchains" class="externalLink">Toolchains</a>.</p> <p>Below are some plugins which are toolchain-aware, with the toolchain-type used:</p> -<table class="bodyTable bodyTableBorder"> +<table class="table table-striped"> +<thead> <tr class="a"> <th>Toolchain type</th> -<th><b>Plugin</b></th> -<th><b>Starting with</b></th> -<th><b>Hosted at</b></th></tr> +<th><strong>Plugin</strong></th> +<th><strong>Starting with</strong></th> +<th><strong>Hosted at</strong></th></tr></thead><tbody> <tr class="b"> -<td style="text-align: center;">jdk</td> -<td style="text-align: left;"><code><a href="/plugins/maven-compiler-plugin/">maven-compiler-plugin</a></code></td> -<td style="text-align: left;">2.1</td> -<td style="text-align: left;">Apache Maven</td></tr> +<td>jdk</td> +<td><code>[maven-compiler-plugin](/plugins/maven-compiler-plugin/)</code></td> +<td>2.1</td> +<td>Apache Maven</td></tr> <tr class="a"> -<td style="text-align: center;">jdk</td> -<td style="text-align: left;"><code><a href="/plugins/maven-jarsigner-plugin/">maven-jarsigner-plugin</a></code></td> -<td style="text-align: left;">1.3</td> -<td style="text-align: left;">Apache Maven</td></tr> +<td>jdk</td> +<td><code>[maven-jarsigner-plugin](/plugins/maven-jarsigner-plugin/)</code></td> +<td>1.3</td> +<td>Apache Maven</td></tr> <tr class="b"> -<td style="text-align: center;">jdk</td> -<td style="text-align: left;"><code><a href="/plugins/maven-javadoc-plugin/">maven-javadoc-plugin</a></code></td> -<td style="text-align: left;">2.5</td> -<td style="text-align: left;">Apache Maven</td></tr> +<td>jdk</td> +<td><code>[maven-javadoc-plugin](/plugins/maven-javadoc-plugin/)</code></td> +<td>2.5</td> +<td>Apache Maven</td></tr> <tr class="a"> -<td style="text-align: center;">jdk</td> -<td style="text-align: left;"><code><a href="/plugins/maven-pmd-plugin/">maven-pmd-plugin</a></code></td> -<td style="text-align: left;">3.14.0</td> -<td style="text-align: left;">Apache Maven</td></tr> +<td>jdk</td> +<td><code>[maven-pmd-plugin](/plugins/maven-pmd-plugin/)</code></td> +<td>3.14.0</td> +<td>Apache Maven</td></tr> <tr class="b"> -<td style="text-align: center;">jdk</td> -<td style="text-align: left;"><code><a href="/plugins/maven-surefire-plugin/">maven-surefire-plugin</a></code></td> -<td style="text-align: left;">2.5</td> -<td style="text-align: left;">Apache Maven</td></tr> +<td>jdk</td> +<td><code>[maven-surefire-plugin](/plugins/maven-surefire-plugin/)</code></td> +<td>2.5</td> +<td>Apache Maven</td></tr> <tr class="a"> -<td style="text-align: center;">jdk</td> -<td style="text-align: left;"><code><a class="externalLink" href="https://www.mojohaus.org/animal-sniffer/animal-sniffer-maven-plugin/">animal-sniffer-maven-plugin</a></code></td> -<td style="text-align: left;">1.3</td> -<td style="text-align: left;">MojoHaus</td></tr> +<td>jdk</td> +<td><code>[animal-sniffer-maven-plugin](https://www.mojohaus.org/animal-sniffer/animal-sniffer-maven-plugin/)</code></td> +<td>1.3</td> +<td>MojoHaus</td></tr> <tr class="b"> -<td style="text-align: center;">jdk</td> -<td style="text-align: left;"><code><a class="externalLink" href="https://www.mojohaus.org/cassandra-maven-plugin/">cassandra-maven-plugin</a></code></td> -<td style="text-align: left;">0.7.0-1</td> -<td style="text-align: left;">MojoHaus</td></tr> +<td>jdk</td> +<td><code>[cassandra-maven-plugin](https://www.mojohaus.org/cassandra-maven-plugin/)</code></td> +<td>0.7.0-1</td> +<td>MojoHaus</td></tr> <tr class="a"> -<td style="text-align: center;">jdk</td> -<td style="text-align: left;"><code><a class="externalLink" href="https://www.mojohaus.org/exec-maven-plugin/">exec-maven-plugin</a></code></td> -<td style="text-align: left;">1.1.1</td> -<td style="text-align: left;">MojoHaus</td></tr> +<td>jdk</td> +<td><code>[exec-maven-plugin](https://www.mojohaus.org/exec-maven-plugin/)</code></td> +<td>1.1.1</td> +<td>MojoHaus</td></tr> <tr class="b"> -<td style="text-align: center;">jdk</td> -<td style="text-align: left;"><code><a class="externalLink" href="https://www.mojohaus.org/jdiff-maven-plugin/">jdiff-maven-plugin</a></code></td> -<td style="text-align: left;">1.0-beta-1-SNAPSHOT</td> -<td style="text-align: left;">MojoHaus</td></tr> +<td>jdk</td> +<td><code>[jdiff-maven-plugin](https://www.mojohaus.org/jdiff-maven-plugin/)</code></td> +<td>1.0-beta-1-SNAPSHOT</td> +<td>MojoHaus</td></tr> <tr class="a"> -<td style="text-align: center;">jdk</td> -<td style="text-align: left;"><code><a class="externalLink" href="https://www.mojohaus.org/keytool/keytool-maven-plugin/">keytool-maven-plugin</a></code></td> -<td style="text-align: left;">1.4</td> -<td style="text-align: left;">MojoHaus</td></tr> +<td>jdk</td> +<td><code>[keytool-maven-plugin](https://www.mojohaus.org/keytool/keytool-maven-plugin/)</code></td> +<td>1.4</td> +<td>MojoHaus</td></tr> <tr class="b"> -<td style="text-align: center;">protobuf</td> -<td style="text-align: left;"><code><a class="externalLink" href="http://sergei-ivanov.github.io/maven-protoc-plugin/examples/protobuf-toolchain.html">maven-protoc-plugin</a></code></td> -<td style="text-align: left;">0.3.2</td> -<td style="text-align: left;">github</td></tr></table></section></section><section> -<h2>Using Toolchains in Your Project</h2> +<td>protobuf</td> +<td><code>[maven-protoc-plugin](http://sergei-ivanov.github.io/maven-protoc-plugin/examples/protobuf-toolchain.html)</code></td> +<td>0.3.2</td> +<td>github</td></tr></tbody> +</table> +</section></section><section> +<h3>Using Toolchains in Your Project</h3> <p>There are two essential components that you need to configure in order to use toolchains:</p> -<ol style="list-style-type: decimal"> -<li>the <code><a href="/plugins/maven-toolchains-plugin/">maven-toolchains-plugin</a></code> in your project POM,</li> -<li>the <code><a href="/ref/current/maven-core/toolchains.html">toolchains.xml</a></code> file on the building machine.</li></ol> +<p>1 the <code>[maven-toolchains-plugin](/plugins/maven-toolchains-plugin/)</code> in your project POM,</p> +<p>1 the <code>[toolchains.xml](/ref/current/maven-core/toolchains.html)</code> file on the building machine.</p> <p>The <code>maven-toolchains-plugin</code> is the one that sets the toolchain to be used by the toolchain-aware plugins in your project.</p> <p>For example, you want to use a different JDK version to build your project than the version used to run Maven, you can configure the version you want to use via this plugin as shown in the <code>pom.xml</code> below:</p> -<div class="source"><pre class="prettyprint linenums"><plugins> + +<div class="source"><pre class="prettyprint linenums"><code><plugins> ... <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -260,11 +279,13 @@ Karl Heinz Marbaise" /> </configuration> </plugin> ... -</plugins></pre></div> -<p>As you can see in the example above, a JDK toolchain with <code><version></code> "1.5" and <code><vendor></code> "sun" is to be used. Now how does the plugin know where this JDK is installed? This is where the <code>toolchains.xml</code> file comes in.</p> -<p>The <code>toolchains.xml</code> file (see below) is the configuration file where you set the installation paths of your toolchains. This file should be put in your <code>${user.home}/.m2</code> directory. When the <code>maven-toolchains-plugin</code> executes, it looks for the <code>toolchains.xml</code> file, reads it and looks for a toolchain matching the toolchains requirements configured in the plugin. In our example, that would be a JDK toolchain with <code><version></code> "1.5" and <code><vendor></code> "sun". Once a match is found, the plugin then stores the toolchain to be used in the MavenSession. As you can see in our <code>toolchains.xml</code> below, there is indeed a JDK toolchain with <code><version></code> "1.5" and <code><vendor></code> "sun" configured. So when the <code>maven-compiler-plugin</code> we've configured in our <code>pom.xml</code> above executes, it will see that a JDK toolchain is set in the MavenSession and will thereby use that toolchain (that would be the JDK installed at <code>/path/to/jdk/1.5</code> for our example) to compile the sources.</p> -<p>Starting with <a href="/docs/3.3.1/release-notes.html">Maven 3.3.1</a> you can put the <code>toolchains.xml</code> file wherever you like by using the <code>--global-toolchains file</code> option but it is recommended to locate it into <code>${user.home}/.m2/</code>. </p> -<div class="source"><pre class="prettyprint linenums"><?xml version="1.0" encoding="UTF-8"?> +</plugins> +</code></pre></div> +<p>As you can see in the example above, a JDK toolchain with <code>\<version\></code> “1.5” and <code>\<vendor\></code> “sun” is to be used. Now how does the plugin know where this JDK is installed? This is where the <code>toolchains.xml</code> file comes in.</p> +<p>The <code>toolchains.xml</code> file (see below) is the configuration file where you set the installation paths of your toolchains. This file should be put in your <code>$\{user.home\}/.m2</code> directory. When the <code>maven-toolchains-plugin</code> executes, it looks for the <code>toolchains.xml</code> file, reads it and looks for a toolchain matching the toolchains requirements configured in the plugin. In our example, that would be a JDK toolchain with <code>\<version\></code> “1.5” and <code>\<vendor\></code> “sun”. Once a match is found, the plugin then stores the toolchain to be used in the MavenSession. As you can see in our <code>toolchains.xml</code> below, there is indeed a JDK toolchain with <code>\<version\></code> “1.5” and <code>\<vendor\></code> “sun” configured. So when the <code>maven-compiler-plugin</code> we've configured in our <code>pom.xml</code> above executes, it will see th at a JDK toolchain is set in the MavenSession and will thereby use that toolchain (that would be the JDK installed at <code>/path/to/jdk/1.5</code> for our example) to compile the sources.</p> +<p>Starting with <a href="/docs/3.3.1/release-notes.html">Maven 3.3.1</a> you can put the <code>toolchains.xml</code> file wherever you like by using the <code>--global-toolchains file</code> option but it is recommended to locate it into <code>$\{user.home\}/.m2/</code>.</p> + +<div class="source"><pre class="prettyprint linenums"><code><?xml version="1.0" encoding="UTF-8"?> <toolchains> <!-- JDK toolchains --> <toolchain> @@ -298,8 +319,9 @@ Karl Heinz Marbaise" /> <installDir>/path/to/netbeans/5.5</installDir> </configuration> </toolchain> -</toolchains></pre></div> -<p>Note that you can configure as many toolchains as you want in your <code>toolchains.xml</code> file.</p></section></section> +</toolchains> +</code></pre></div> +<p>Note that you can configure as many toolchains as you want in your <code>toolchains.xml</code> file.</p></section></section></section> </main> </div> </div> Modified: maven/website/content/guides/mini/guide-wagon-providers.html ============================================================================== --- maven/website/content/guides/mini/guide-wagon-providers.html (original) +++ maven/website/content/guides/mini/guide-wagon-providers.html Thu Feb 9 00:34:05 2023 @@ -2,7 +2,7 @@ <!-- - | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from content/apt/guides/mini/guide-wagon-providers.apt at 2023-02-08 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from content/markdown/guides/mini/guide-wagon-providers.md at 2023-02-09 | Rendered using Apache Maven Fluido Skin 1.11.1 --> <html xmlns="http://www.w3.org/1999/xhtml" lang=""> @@ -48,8 +48,8 @@ <ul class="breadcrumb"> <li class=""><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> <li class=""><a href="../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> - <li class="active ">Guide to Selecting Alternative Wagon Providers <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-wagon-providers.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> - <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2023-02-08</li> + <li class="active ">Guide to Selecting Alternative Wagon Providers <a href="https://github.com/apache/maven-site/tree/master/content/markdown/guides/mini/guide-wagon-providers.md"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2023-02-09</li> <li class="pull-right"><span class="divider">|</span> <a href="../../scm.html" title="Get Sources">Get Sources</a></li> <li class="pull-right"><a href="../../download.cgi" title="Download">Download</a></li> @@ -152,20 +152,40 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section> -<h1>Guide to Selecting Alternative Wagon Providers</h1> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<section><section> +<h2>Guide to Selecting Alternative Wagon Providers</h2> <p>By default, Maven uses the <code>java.net.URLConnection</code> (<code>HttpURLConnection</code>) classes provided with the JDK to access repositories that use the HTTP/HTTPs protocols. Unfortunately, since this implementation contains certain bugs, Maven users may find themselves unable to connect to servers that demand some configurations. A couple examples of weird behavior include line-wrapping the Authorization header's Base64 value when passwords are long, and using cached values in preemptive authentication for successive connections to the same server.</p> <p>Maven 2.2.0 attempted to amend this problem by switching over to a Wagon implementation that's based on Apache HttpClient. Unfortunately, it soon became apparent that HttpClient doesn't support NTLM (at least, version 2), which effectively means users behind NTLMv2 proxies cannot use Maven 2.2.0.</p> -<p>To hopefully resolve this once and for all, Maven 2.2.1 will contain support for specifying which Wagon provider you want to use for a given protocol during the build. The provider name will then be appended to the protocol using the format <code><protocol>-<provider></code> to form the component role-hint for the Wagon.</p> -<p>As of Maven 2.2.1, there are two ways to specify which Wagon provider should be used: via the command line, or in the <code><server></code> configuration section of the <code>settings.xml</code>.</p><section> -<h2>Command-Line Configuration</h2> -<p>To specify the Wagon provider from the command line, simply use the <code>-Dmaven.wagon.provider.<protocol>=<provider-name></code> command-line option, like the following:</p> -<div> -<pre>mvn -Dmaven.wagon.provider.http=httpclient clean install</pre></div> +<p>To hopefully resolve this once and for all, Maven 2.2.1 will contain support for specifying which Wagon provider you want to use for a given protocol during the build. The provider name will then be appended to the protocol using the format <code>\<protocol\>-\<provider\></code> to form the component role-hint for the Wagon.</p> +<p>As of Maven 2.2.1, there are two ways to specify which Wagon provider should be used: via the command line, or in the <code>\<server\></code> configuration section of the <code>settings.xml</code>.</p><section> +<h3>Command-Line Configuration</h3> +<p>To specify the Wagon provider from the command line, simply use the <code>-Dmaven.wagon.provider.\<protocol\>\=\<provider-name\></code> command-line option, like the following:</p> + +<div class="source"><pre class="prettyprint linenums"><code>mvn -Dmaven.wagon.provider.http=httpclient clean install +</code></pre></div> <p>This instructs Maven to use the HttpClient-based Wagon implementation for connections to HTTP repositories.</p></section><section> -<h2><code>settings.xml</code> Configuration</h2> -<p>To specify which Wagon provider to use for a particular server, modify your <code>settings.xml</code> file to add the <code><wagonProvider></code> configuration to your <code><server></code> entry, like the following:</p> -<div class="source"><pre class="prettyprint linenums"><settings> +<h3><code>settings.xml</code> Configuration</h3> +<p>To specify which Wagon provider to use for a particular server, modify your <code>settings.xml</code> file to add the <code>\<wagonProvider\></code> configuration to your <code>\<server\></code> entry, like the following:</p> + +<div class="source"><pre class="prettyprint linenums"><code><settings> [...] <servers> <server> @@ -174,16 +194,19 @@ <wagonProvider>httpclient</wagonProvider> [...] </configuration> - </server></pre></div></section><section> -<h2>Available Wagon Providers</h2> -<p>Maven 2.2.1 provides two providers for HTTP/HTTPS Wagons: <code>lightweight</code> and <code>httpclient</code>. If you add a new HTTP Wagon implementation via build extension, you'll need to make sure the extension binds its Wagon components to role-hints of the form <code><protocol>-<provider></code> in order to allow users to specify your alternative Wagon provider. For instance, the HttpClient HTTP Wagon component definition looks like this:</p> -<div class="source"><pre class="prettyprint linenums"><component> + </server> +</code></pre></div></section><section> +<h3>Available Wagon Providers</h3> +<p>Maven 2.2.1 provides two providers for HTTP/HTTPS Wagons: <code>lightweight</code> and <code>httpclient</code>. If you add a new HTTP Wagon implementation via build extension, you'll need to make sure the extension binds its Wagon components to role-hints of the form <code>\<protocol\>-\<provider\></code> in order to allow users to specify your alternative Wagon provider. For instance, the HttpClient HTTP Wagon component definition looks like this:</p> + +<div class="source"><pre class="prettyprint linenums"><code><component> <role>org.apache.maven.wagon.Wagon</role> <role-hint>http-httpclient</role-hint> <implementation>org.apache.maven.wagon.providers.http.HttpWagon</implementation> <instantiation-strategy>per-lookup</instantiation-strategy> -</component></pre></div> -<p><b>NOTE:</b> The default provider for HTTP/HTTPS Wagons is <code>lightweight</code>.</p></section></section> +</component> +</code></pre></div> +<p><strong>NOTE:</strong> The default provider for HTTP/HTTPS Wagons is <code>lightweight</code>.</p></section></section></section> </main> </div> </div> Modified: maven/website/content/guides/mini/index.html ============================================================================== --- maven/website/content/guides/mini/index.html (original) +++ maven/website/content/guides/mini/index.html Thu Feb 9 00:34:05 2023 @@ -2,7 +2,7 @@ <!-- - | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from content/apt/guides/mini/index.apt.vm at 2023-02-08 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from content/apt/guides/mini/index.apt.vm at 2023-02-09 | Rendered using Apache Maven Fluido Skin 1.11.1 --> <html xmlns="http://www.w3.org/1999/xhtml" lang=""> @@ -49,7 +49,7 @@ <li class=""><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> <li class=""><a href="../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> <li class="active ">Maven Mini Guides <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/index.apt.vm"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> - <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2023-02-08</li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2023-02-09</li> <li class="pull-right"><span class="divider">|</span> <a href="../../scm.html" title="Get Sources">Get Sources</a></li> <li class="pull-right"><a href="../../download.cgi" title="Download">Download</a></li> 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 Thu Feb 9 00:34:05 2023 @@ -2,7 +2,7 @@ <!-- - | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from content/apt/guides/plugin/guide-java-plugin-development.apt at 2023-02-08 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from content/markdown/guides/plugin/guide-java-plugin-development.md at 2023-02-09 | Rendered using Apache Maven Fluido Skin 1.11.1 --> <html xmlns="http://www.w3.org/1999/xhtml" lang=""> @@ -10,9 +10,7 @@ <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0-M4" /> - <meta name="author" content="Bob Allison -Vincent Siveton -Olivier Lamy" /> + <meta name="author" content="Bob Allison, Vincent Siveton, Olivier Lamy" /> <meta name="date" content="2013-01-02" /> <title>Maven – Guide to Developing Java Plugins</title> <link rel="stylesheet" href="../../css/apache-maven-fluido-1.11.1.min.css" /> @@ -50,8 +48,8 @@ Olivier Lamy" /> <ul class="breadcrumb"> <li class=""><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> <li class=""><a href="../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> - <li class="active ">Guide to Developing Java Plugins <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/plugin/guide-java-plugin-development.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> - <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2023-02-08</li> + <li class="active ">Guide to Developing Java Plugins <a href="https://github.com/apache/maven-site/tree/master/content/markdown/guides/plugin/guide-java-plugin-development.md"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2023-02-09</li> <li class="pull-right"><span class="divider">|</span> <a href="../../scm.html" title="Get Sources">Get Sources</a></li> <li class="pull-right"><a href="../../download.cgi" title="Download">Download</a></li> @@ -138,40 +136,72 @@ Olivier Lamy" /> </div> </header> <main id="bodyColumn" class="span10" > -<section> -<h1>Introduction</h1> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +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> <ul> -<li><a href="#Important_Notice:_Plugin_Naming_Convention_and_Apache_Maven_Trademark">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> -<ul> -<li><a href="#A_Simple_Mojo">A Simple Mojo</a></li></ul></li> -<li><a href="#Project_Definition">Project Definition</a></li> -<li><a href="#Building_a_Plugin">Building a Plugin</a></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></ul></li> -<li><a href="#Mojo_archetype">Mojo archetype</a></li> -<li><a href="#Parameters">Parameters</a> -<ul> -<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> -<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><yourplugin>-maven-plugin</code>.</p> -<p>Calling it <code>maven-<yourplugin>-plugin</code> (note "Maven" is at the beginning of the plugin name) is <b>strongly discouraged</b> since it's a <b>reserved naming pattern for official Apache Maven plugins maintained by the Apache Maven team</b> with groupId <code>org.apache.maven.plugins</code>. Using this naming pattern is an infringement of the Apache Maven Trademark.</p></section><section> -<h2>Your First Plugin</h2> + +<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> +</ul><section> +<h3>Important Notice: <a href="../mini/guide-naming-conventions.html">Plugin Naming Convention and Apache Maven Trademark</a></h3> +<p>You will typically name your plugin <code>\<yourplugin\>-maven-plugin</code>.</p> +<p>Calling it <code>maven-\<yourplugin\>-plugin</code> (note “Maven” 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> -<h3>Your First Mojo</h3> +<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 "<code>goal</code>" javadoc annotation. Any class with this annotation are included in the plugin configuration file.</p><section> -<h4>A Simple Mojo</h4> +<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 “<code>goal</code>” 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> -<div class="source"><pre class="prettyprint linenums">package sample.plugin; + +<div class="source"><pre class="prettyprint linenums"><code>package sample.plugin; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; @@ -188,36 +218,48 @@ public class GreetingMojo extends Abstra { getLog().info( "Hello, world." ); } -}</pre></div> -<ul> -<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 "<code>@Mojo</code>" is required and control how and when the mojo is executed.</li> -<li>The <code>execute</code> method can throw two exceptions: +} +</code></pre></div> <ul> -<li><code>org.apache.maven.plugin.MojoExecutionException</code> if an unexpected problem occurs. Throwing this exception causes a "BUILD ERROR" message to be displayed.</li> -<li><code>org.apache.maven.plugin.MojoFailureException</code> if an expected problem (such as a compilation failure) occurs. Throwing this exception causes a "BUILD FAILURE" 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 "debug", "info", "warn", and "error". 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> + +<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 “<code>@Mojo</code>” 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 “BUILD ERROR” 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 “BUILD FAILURE” 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 “debug”, “info”, “warn”, and “error”. 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> +</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> -<h3>Project Definition</h3> +<h4>Project Definition</h4> <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="bodyTable bodyTableBorder"> +<table class="table table-striped"> +<thead> <tr class="a"> -<td style="text-align: left;"><code>groupId</code></td> -<td style="text-align: left;">This is the group ID for the plugin, and should match the common prefix to the packages used by the mojos</td></tr> +<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> <tr class="b"> -<td style="text-align: left;"><code>artifactId</code></td> -<td style="text-align: left;">This is the name of the plugin</td></tr> +<td><code>artifactId</code></td> +<td>This is the name of the plugin</td></tr> <tr class="a"> -<td style="text-align: left;"><code>version</code></td> -<td style="text-align: left;">This is the version of the plugin</td></tr> +<td><code>version</code></td> +<td>This is the version of the plugin</td></tr> <tr class="b"> -<td style="text-align: left;"><code>packaging</code></td> -<td style="text-align: left;">This should be set to "<code>maven-plugin</code>"</td></tr> +<td><code>packaging</code></td> +<td>This should be set to “<code>maven-plugin</code>”</td></tr> <tr class="a"> -<td style="text-align: left;"><code>dependencies</code></td> -<td style="text-align: left;">A dependency must be declared to the Maven Plugin Tools API to resolve "<code>AbstractMojo</code>" and related classes</td></tr></table> +<td><code>dependencies</code></td> +<td>A dependency must be declared to the Maven Plugin Tools API to resolve “<code>AbstractMojo</code>” and related classes</td></tr></tbody> +</table> + <p>Listed below is an illustration of the sample mojo project's pom with the parameters set as described in the above table:</p> -<div class="source"><pre class="prettyprint linenums"><project> + +<div class="source"><pre class="prettyprint linenums"><code><project> <modelVersion>4.0.0</modelVersion> <groupId>sample.plugin</groupId> @@ -243,32 +285,37 @@ public class GreetingMojo extends Abstra <scope>provided</scope> </dependency> </dependencies> -</project></pre></div></section><section> -<h3>Building a Plugin</h3> +</project> +</code></pre></div></section><section> +<h4>Building a Plugin</h4> <p>There are few plugins goals bound to the standard build lifecycle defined with the <code>maven-plugin</code> packaging:</p> -<table class="bodyTable bodyTableBorder"> +<table class="table table-striped"> +<thead> <tr class="a"> -<td style="text-align: left;"><code>compile</code></td> -<td style="text-align: left;">Compiles the Java code for the plugin</td></tr> +<th><code>compile</code></th> +<th>Compiles the Java code for the plugin</th></tr></thead><tbody> <tr class="b"> -<td style="text-align: left;"><code>process-classes</code></td> -<td style="text-align: left;">Extracts data to build the <a href="/ref/current/maven-plugin-api/plugin.html">plugin descriptor</a></td></tr> +<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"> -<td style="text-align: left;"><code>test</code></td> -<td style="text-align: left;">Runs the plugin's unit tests</td></tr> +<td><code>test</code></td> +<td>Runs the plugin's unit tests</td></tr> <tr class="b"> -<td style="text-align: left;"><code>package</code></td> -<td style="text-align: left;">Builds the plugin jar</td></tr> +<td><code>package</code></td> +<td>Builds the plugin jar</td></tr> <tr class="a"> -<td style="text-align: left;"><code>install</code></td> -<td style="text-align: left;">Installs the plugin jar in the local repository</td></tr> +<td><code>install</code></td> +<td>Installs the plugin jar in the local repository</td></tr> <tr class="b"> -<td style="text-align: left;"><code>deploy</code></td> -<td style="text-align: left;">Deploys the plugin jar to the remote repository</td></tr></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> -<h3>Executing Your First Mojo</h3> +<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> -<div class="source"><pre class="prettyprint linenums">... + +<div class="source"><pre class="prettyprint linenums"><code>... <build> <pluginManagement> <plugins> @@ -280,25 +327,35 @@ public class GreetingMojo extends Abstra </plugins> </pluginManagement> </build> -...</pre></div> +... +</code></pre></div> <p>And, you need to specify a fully-qualified goal in the form of:</p> -<div> -<pre>mvn groupId:artifactId:version:goal</pre></div> -<p>For example, to run the simple mojo in the sample plugin, you would enter "<code>mvn sample.plugin:hello-maven-plugin:1.0-SNAPSHOT:sayhi</code>" on the command line.</p> -<p><b>Tips</b>: <code>version</code> is not required to run a standalone goal.</p><section> -<h4>Shortening the Command Line</h4> + +<div class="source"><pre class="prettyprint linenums"><code>mvn groupId:artifactId:version:goal +</code></pre></div> +<p>For example, to run the simple mojo in the sample plugin, you would enter “<code>mvn sample.plugin:hello-maven-plugin:1.0-SNAPSHOT:sayhi</code>” 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> <p>There are several ways to reduce the amount of required typing:</p> <ul> -<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 "<code>mvn sample.plugin:hello-maven-plugin:sayhi</code>" 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: -<div class="source"><pre class="prettyprint linenums"><pluginGroups> + +<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 “<code>mvn sample.plugin:hello-maven-plugin:sayhi</code>” 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> +</ul> + +<div class="source"><pre class="prettyprint linenums"><code><pluginGroups> <pluginGroup>sample.plugin</pluginGroup> -</pluginGroups></pre></div></li></ul> -<p>At this point, you can run the mojo with "<code>mvn hello:sayhi</code>".</p></section><section> -<h4>Attaching the Mojo to the Build Lifecycle</h4> +</pluginGroups> +</code></pre></div> +<p>At this point, you can run the mojo with “<code>mvn hello:sayhi</code>”.</p></section><section> +<h5>Attaching the Mojo to the Build Lifecycle</h5> <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"> <build> + +<div class="source"><pre class="prettyprint linenums"><code> <build> <pluginManagement> <plugins> <plugin> @@ -322,44 +379,55 @@ public class GreetingMojo extends Abstra </executions> </plugin> </plugins> - </build></pre></div> + </build> +</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> -<h2>Mojo archetype</h2> +<h3>Mojo archetype</h3> <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> -<pre>mvn archetype:generate \ + +<div class="source"><pre class="prettyprint linenums"><code>mvn archetype:generate \ -DgroupId=sample.plugin \ -DartifactId=hello-maven-plugin \ -DarchetypeGroupId=org.apache.maven.archetypes \ - -DarchetypeArtifactId=maven-archetype-plugin</pre></div></section><section> -<h2><a id="Parameters">Parameters</a></h2> + -DarchetypeArtifactId=maven-archetype-plugin +</code></pre></div></section><section> +<h3>Parameters</h3> <p>It is unlikely that a mojo will be very useful without parameters. Parameters provide a few very important functions:</p> <ul> -<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> -<h3>Defining Parameters Within a Mojo</h3> + +<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> +</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> -<div class="source"><pre class="prettyprint linenums"> /** + +<div class="source"><pre class="prettyprint linenums"><code> /** * The greeting to display. */ @Parameter( property = "sayhi.greeting", defaultValue = "Hello World!" ) - private String greeting;</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 "<code>${project.version}</code>" (more can be found in the <a href="/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html">"Parameter Expressions" 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> -<h3>Configuring Parameters in a Project</h3> + 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 “<code>$\{project.version\}</code>” (more can be found in the <a href="/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html">“Parameter Expressions” 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> -<div class="source"><pre class="prettyprint linenums"><plugin> + +<div class="source"><pre class="prettyprint linenums"><code><plugin> <groupId>sample.plugin</groupId> <artifactId>hello-maven-plugin</artifactId> <version>1.0-SNAPSHOT</version> <configuration> <greeting>Welcome</greeting> </configuration> -</plugin></pre></div> -<p>In the configuration section, the element name ("<code>greeting</code>") is the parameter name and the contents of the element ("<code>Welcome</code>") is the value to be assigned to the parameter.</p> -<p><b>Note</b>: More details can be found in the <a href="../mini/guide-configuring-plugins.html">Guide to Configuring Plugins</a>.</p></section></section><section> -<h2>Using Setters</h2> +</plugin> +</code></pre></div> +<p>In the configuration section, the element name (“<code>greeting</code>”) is the parameter name and the contents of the element (“<code>Welcome</code>”) 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> -<div class="source"><pre class="prettyprint linenums"> + +<div class="source"><pre class="prettyprint linenums"><code> public class MyQueryMojo extends AbstractMojo { @@ -393,16 +461,16 @@ public class MyQueryMojo ... } } -</pre></div> + +</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> -<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 class="externalLink" href="https://codehaus-plexus.github.io/">Plexus</a>: The IoC container used by Maven.</li> -<li><a class="externalLink" href="https://codehaus-plexus.github.io/plexus-utils/">Plexus Common Utilities</a>: Set of utilities classes useful for Mojo development.</li> -<li><a class="externalLink" href="http://commons.apache.org/io/">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> +<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> </main> </div> </div>
