Modified: maven/website/content/guides/mini/guide-configuring-plugins.html ============================================================================== --- maven/website/content/guides/mini/guide-configuring-plugins.html (original) +++ maven/website/content/guides/mini/guide-configuring-plugins.html Sun May 12 07:42:36 2024 @@ -2,18 +2,18 @@ <!-- - | Generated by Apache Maven Doxia Site Renderer 2.0.0-M18 from content/apt/guides/mini/guide-configuring-plugins.apt at 2024-05-11 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M10 from content/apt/guides/mini/guide-configuring-plugins.apt at 2024-05-12 | Rendered using Apache Maven Fluido Skin 2.0.0-M6 --> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <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-M18" /> + <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0-M10" /> <meta name="author" content="Jason van Zyl" /> <meta name="author" content="Vincent Siveton" /> <meta name="date" content="2009-08-26" /> - <title>Maven</title> + <title>Maven â Guide to Configuring Plug-ins</title> <link rel="stylesheet" href="../../css/apache-maven-fluido-2.0.0-M6.min.css" /> <link rel="stylesheet" href="../../css/site.css" /> <link rel="stylesheet" href="../../css/print.css" media="print" /> @@ -40,10 +40,8 @@ <div class="container-fluid"> <header> <div id="banner"> - <div class="pull-left"><a href="https://www.apache.org/" id="bannerLeft"><h1>Apache Maven Site</h1> -</a></div> - <div class="pull-right"><a href="../.././" id="bannerRight"><h1>$esc.xml( $banner.name )</h1> -</a></div> + <div class="pull-left"><a href="https://www.apache.org/" id="bannerLeft"><img src="../../images/apache-maven-project.png" alt="Apache Maven Site" style="" /></a></div> + <div class="pull-right"><a href="../.././" id="bannerRight"><img src="../../images/maven-logo-black-on-white.png" alt="" style="" /></a></div> <div class="clear"><hr/></div> </div> @@ -51,9 +49,8 @@ <ul class="breadcrumb"> <li><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> <li><a href="../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> - - <li class="active ">Maven <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-configuring-plugins.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> - <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2024-05-11</li> + <li class="active ">Guide to Configuring Plug-ins <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-configuring-plugins.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2024-05-12</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> @@ -151,7 +148,7 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section><a id="Guide_to_Configuring_Plug-ins"></a> +<section> <h1>Guide to Configuring Plug-ins</h1> <ul> <li><a href="#Introduction">Introduction</a></li> @@ -176,7 +173,7 @@ <ul> <li><a href="#Using_the_.3Creporting.3E_Tag_VS_.3Cbuild.3E_Tag">Using the <reporting> Tag VS <build> Tag</a></li> <li><a href="#Using_the_.3CreportSets.3E_Tag">Using the <reportSets> Tag</a></li> -<li><a href="#Using_the_.3Cinherited.3E_Tag_In_Reporting_Plugins">Using the <inherited> Tag In Reporting Plugins</a></li></ul></li></ul><section><a id="Introduction"></a> +<li><a href="#Using_the_.3Cinherited.3E_Tag_In_Reporting_Plugins">Using the <inherited> Tag In Reporting Plugins</a></li></ul></li></ul><section> <h2>Introduction</h2> <p>In Maven, there are two kinds of plugins, build and reporting:</p> <ul> @@ -186,7 +183,7 @@ <p><b>Important Note</b>: Always define the version of each plugin used to guarantee build reproducibility. A good practice is to specify each build plugin's version in a <code><build><pluginManagement/></build></code> element. Often the <pluginManagement/> element is found in the parent POM. For reporting plugins, specify each version in the <code><reporting><plugins/></reporting></code> element (and in the <code><build><pluginManagement/></build></code> element too).</p></section><section> <h2><a id="Generic_Configuration">Generic Configuration</a></h2> <p>Maven plugins (build and reporting) are configured by specifying a <code><configuration></code> element where the child elements of the <code><configuration></code> element are mapped to fields, or setters, inside your Mojo. (Remember that a plug-in consists of one or more Mojos where a Mojo maps to a goal.) Say, for example, you have a Mojo that performs a query against a particular URL, with a specified timeout and list of options. The Mojo might look like the following:</p> -<pre><code>@Mojo( name = "query" ) +<div class="verbatim source"><pre class="prettyprint linenums">@Mojo( name = "query" ) public class MyQueryMojo extends AbstractMojo { @@ -204,9 +201,9 @@ public class MyQueryMojo { ... } -}</code></pre> +}</pre></div> <p>To configure the Mojo from your POM with the desired URL, timeout and options you might have something like the following:</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <build> <plugins> @@ -226,20 +223,22 @@ public class MyQueryMojo </plugins> </build> ... -</project></code></pre> +</project></pre></div> <p>The elements in the configuration match the names of the fields in the Mojo. The mapping is straight forward. The <code>url</code> element maps to the <code>url</code> field, the <code>timeout</code> element maps to the <code>timeout</code> field, and the <code>options</code> element maps to the <code>options</code> field. The mapping mechanism can deal with arrays by inspecting the type of the field and determining if a suitable mapping is possible.</p> <p>For Mojos that are intended to be executed directly from the CLI, their parameters usually provide a means to be configured via system properties instead of a <code><configuration></code> section in the POM. The plugin documentation for those parameters will list an <i>expression</i> that denotes the system properties for the configuration. In the Mojo above, the parameter <code>url</code> is associated with the expression <code>${query.url}</code>, meaning its value can be specified by the system property <code>query.url</code> as shown below:</p> -<pre>mvn myquery:query -Dquery.url=http://maven.apache.org</pre> +<div class="verbatim"> +<pre>mvn myquery:query -Dquery.url=http://maven.apache.org</pre></div> <p>The name of the system property does not necessarily match the name of the mojo parameter. While this is a rather common practice, you will often notice plugins that employ some prefix for the system properties to avoid name clashes with other system properties. Though rarely, there are also plugin parameters that (e.g. for historical reasons) employ system properties which are completely unrelated to the parameter name. So be sure to have a close look at the plugin documentation.</p><section> <h3><a id="Help_Goal">Help Goal</a></h3> <p>Most Maven plugins have a <code>help</code> goal that prints a description of the plugin and its parameters and types. For instance, to see help for the javadoc goal, type:</p> -<pre>mvn javadoc:help -Ddetail -Dgoal=javadoc</pre> +<div class="verbatim"> +<pre>mvn javadoc:help -Ddetail -Dgoal=javadoc</pre></div> <p>And you will see all parameters for the javadoc:javadoc goal, similar to this <a href="/plugins/maven-javadoc-plugin/javadoc-mojo.html">page</a>.</p></section><section> <h3><a id="Configuring_Parameters">Configuring Parameters</a></h3> <p>Parameterization of Mojos relies internally on the Plexus Component Configuration API provided by <a class="externalLink" href="https://github.com/eclipse/sisu.plexus">sisu-plexus</a>.</p><section> <h4><a id="Mapping_Value_Objects">Mapping Value Objects</a></h4> <p>Mapping value types, like Boolean or Integer, is very simple. The <code><configuration></code> element might look like the following:</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <configuration> <myString>a string</myString> @@ -250,7 +249,7 @@ public class MyQueryMojo <myURL>http://maven.apache.org</myURL> </configuration> ... -</project></code></pre> +</project></pre></div> <p>The detailed type coercion is explained in the table below. For conversion to primitive types their according <a class="externalLink" href="https://docs.oracle.com/javase/tutorial/java/data/autoboxing.html">wrapper classes are used and automatically unboxed</a>.</p> <table class="table table-bordered table-striped"> <tr class="a"> @@ -309,7 +308,7 @@ public class MyQueryMojo <td style="text-align: center;"><a class="externalLink" href="https://docs.oracle.com/javase/8/docs/api/java/net/URL.html#URL-java.lang.String-"><code>new URL(String)</code></a></td></tr></table></section><section> <h4><a id="Mapping_Complex_Objects">Mapping Complex Objects</a></h4> <p>Mapping complex types is also fairly straight forward. Let's look at a simple example where we are trying to map a configuration for Person object. The <code><configuration/></code> element might look like the following:</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <configuration> <person> @@ -318,13 +317,13 @@ public class MyQueryMojo </person> </configuration> ... -</project></code></pre> +</project></pre></div> <p>The rules for mapping complex objects are as follows:</p> <ul> <li>There must be a private field that corresponds to name of the element being mapped. So in our case the <code>person</code> element must map to a <code>person</code> field in the mojo.</li> <li>The object instantiated must be in the same package as the Mojo itself. So if your mojo is in <code>com.mycompany.mojo.query</code> then the mapping mechanism will look in that package for an object named <code>Person</code>. The mechanism capitalizes the first letter of the element name and uses that to search for the object to instantiate.</li> <li>If you wish to have the object to be instantiated live in a different package or have a more complicated name, specify this using an <code>implementation</code> attribute like the following:</li></ul> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <configuration> <person implementation="com.mycompany.mojo.query.SuperPerson"> @@ -333,12 +332,12 @@ public class MyQueryMojo </person> </configuration> ... -</project></code></pre></section><section> +</project></pre></div></section><section> <h4><a id="Mapping_Collection_Types">Mapping Collection Types</a></h4> <p>The configuration mapping mechanism can easily deal with most collections so let's go through a few examples to show you how it's done:</p><section> <h5><a id="Mapping_Collections_and_Arrays">Mapping Collections and Arrays</a></h5> <p>Mapping to collections works in much the same way as mapping to arrays. Each item is given in the XML as dedicated element. The element name does not matter in that case. So if you have a mojo like the following:</p> -<pre><code>public class MyAnimalMojo +<div class="verbatim source"><pre class="prettyprint linenums">public class MyAnimalMojo extends AbstractMojo { @Parameter(property = "animals") @@ -349,9 +348,9 @@ public class MyQueryMojo { ... } -}</code></pre> +}</pre></div> <p>where you have a field named <code>animals</code> then your configuration for the plug-in would look like the following:</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <build> <plugins> @@ -369,9 +368,9 @@ public class MyQueryMojo </plugins> </build> ... -</project></code></pre> +</project></pre></div> <p>Where each of the animals listed would be entries in the <code>animals</code> field. Unlike arrays, collections do not necessarily have a specific component type. In order to derive the type of a collection item, the following strategy is used:</p> -<ol style="list-style-type: decimal;"> +<ol style="list-style-type: decimal"> <li>If the first item XML element contains an <code>implementation</code> hint attribute, try to load the class with the given fully qualified class name from the attribute value</li> <li>If the first item XML element contains a <code>.</code>, try to load the class with the fully qualified class name given in the element name</li> <li>Try the first item XML element name (with capitalized first letter) as a class in the same package as the mojo/object being configured</li> @@ -392,7 +391,7 @@ public class MyQueryMojo <td style="text-align: center;"><code>ArrayList</code></td> <td style="text-align: center;">for every other <code>Collection</code> type which is not a <code>Map</code></td></tr></table> <p>Since Maven 3.3.9 (<a class="externalLink" href="https://issues.apache.org/jira/browse/MNG-5440">MNG-5440</a>), you can list individual items alternatively as comma-separated list in the XML value of animals directly. This approach is also used if configuring collection/array parameters via command line The following example is equivalent to the example above:</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <build> <plugins> @@ -406,15 +405,15 @@ public class MyQueryMojo </plugins> </build> ... -</project></code></pre> +</project></pre></div> <p>Each item is mapped again according to the rules of this section depending on the type of the collection/array.</p></section><section> <h5><a id="Mapping_Maps">Mapping Maps</a></h5> <p>In the same way, you could define maps like the following:</p> -<pre><code>... +<div class="verbatim source"><pre class="prettyprint linenums">... @Parameter private Map<String,String> myMap; -...</code></pre> -<pre><code><project> +...</pre></div> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <configuration> <myMap> @@ -423,17 +422,17 @@ public class MyQueryMojo </myMap> </configuration> ... -</project></code></pre> +</project></pre></div> <p>Unlike Collections the value type for Maps is always derived from the parameter type information from either <a class="externalLink" href="https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Field.html#getGenericType()"><code>Field.getGenericType()</code></a> or <a class="externalLink" href="https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Method.html#getGenericParameterTypes()"><code>Method.getGenericParameterTypes()</code></a>. It falls back to <code>String</code>. The key type must always be <code>String</code>.</p> <p>In contrast to value objects and collections/arrays there is no string coercion defined for maps, i.e. you cannot give parameters of that type via CLI argument. </p> <p>The map implementation class is by default <code>TreeMap</code> but can be overridden with an <code>implementation</code> attribute on the XML element representing the map.</p></section><section> <h5><a id="Mapping_Properties">Mapping Properties</a></h5> <p>Properties should be defined like the following:</p> -<pre><code>... +<div class="verbatim source"><pre class="prettyprint linenums">... @Parameter private Properties myProperties; -...</code></pre> -<pre><code><project> +...</pre></div> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <configuration> <myProperties> @@ -448,13 +447,13 @@ public class MyQueryMojo </myProperties> </configuration> ... -</project></code></pre> +</project></pre></div> <p>In contrast to value objects and collections/arrays there is no string coercion defined for properties, i.e. you cannot give parameters of those type via CLI argument. </p></section></section></section></section><section> <h2><a id="Configuring_Build_Plugins">Configuring Build Plugins</a></h2> <p>The following is only to configure Build plugins in the <code><build></code> element.</p><section> <h3><a id="Using_the_.3Cexecutions.3E_Tag">Using the <code><executions></code> Tag</a></h3> <p>You can also configure a mojo using the <code><executions></code> tag. This is most commonly used for mojos that are intended to participate in some phases of the <a href="../introduction/introduction-to-the-lifecycle.html">build lifecycle</a>. Using <code>MyQueryMojo</code> as an example, you may have something that will look like:</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <build> <plugins> @@ -498,11 +497,11 @@ public class MyQueryMojo </plugins> </build> ... -</project></code></pre> +</project></pre></div> <p>The first execution with id "execution1" binds this configuration to the test phase. The second execution does not have a <code><phase></code> tag, how do you think will this execution behave? Well, goals can have a default phase binding as discussed further below. If the goal has a default phase binding then it will execute in that phase. But if the goal is not bound to any lifecycle phase then it simply won't be executed during the build lifecycle.</p> <p>Note that while execution id's have to be unique among all executions of a single plugin within a POM, they don't have to be unique across an inheritance hierarchy of POMs. Executions of the same id from different POMs are merged. The same applies to executions that are defined by profiles.</p> <p>How about if we have a multiple executions with different phases bound to it? How do you think will it behave? Let us use the example POM above again, but this time we shall bind <code>execution2</code> to a phase.</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <build> <plugins> @@ -535,10 +534,10 @@ public class MyQueryMojo </plugins> </build> ... -</project></code></pre> +</project></pre></div> <p>If there are multiple executions bound to different phases, then the mojo is executed once for each phase indicated. Meaning, <code>execution1</code> will be executed applying the configuration setup when the phase of the build is test, and <code>execution2</code> will be executed applying the configuration setup when the build phase is already in install.</p> <p>Now, let us have another mojo example which shows a default lifecycle phase binding.</p> -<pre><code>@Mojo( name = "query", defaultPhase = LifecyclePhase.PACKAGE ) +<div class="verbatim source"><pre class="prettyprint linenums">@Mojo( name = "query", defaultPhase = LifecyclePhase.PACKAGE ) public class MyBoundQueryMojo extends AbstractMojo { @@ -556,9 +555,9 @@ public class MyBoundQueryMojo { ... } -}</code></pre> +}</pre></div> <p>From the above mojo example, <code>MyBoundQueryMojo</code> is by default bound to the package phase (see the <code>@phase</code> notation). But if we want to execute this mojo during the install phase and not with package we can rebind this mojo into a new lifecycle phase using the <code><phase></code> tag under <code><execution></code>.</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <build> <plugins> @@ -587,14 +586,15 @@ public class MyBoundQueryMojo </plugins> </build> ... -</project></code></pre> +</project></pre></div> <p>Now, <code>MyBoundQueryMojo</code> default phase which is package has been overridden by install phase.</p> <p><b>Note:</b> Configurations inside the <code><executions></code> element used to differ from those that are outside <code><executions></code> in that they could not be used from a direct command line invocation because they were only applied when the lifecycle phase they were bound to was invoked. So you had to move a configuration section outside of the executions section to apply it globally to all invocations of the plugin. Since Maven 3.3.1 this is not the case anymore as you can specify on the command line the execution id for direct plugin goal invocation. Hence if you want to run the above plugin and it's specific execution1's configuration from the command-line, you can execute:</p> -<pre>mvn myquery:query@execution1</pre></section><section> +<div class="verbatim"> +<pre>mvn myquery:query@execution1</pre></div></section><section> <h3><a id="Using_the_.3Cdependencies.3E_Tag">Using the <code><dependencies></code> Tag</a></h3> <p>You could configure the dependencies of the Build plugins, commonly to use a more recent dependency version.</p> <p>For instance, the Maven Antrun Plugin version 1.2 uses Ant version 1.6.5, if you want to use the latest Ant version when running this plugin, you need to add <code><dependencies></code> element like the following:</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <build> <plugins> @@ -619,10 +619,10 @@ public class MyBoundQueryMojo </plugins> </build> ... -</project></code></pre></section><section> +</project></pre></div></section><section> <h3><a id="Using_the_.3Cinherited.3E_Tag_In_Build_Plugins">Using the <code><inherited></code> Tag In Build Plugins</a></h3> <p>By default, plugin configuration should be propagated to child POMs, so to break the inheritance, you could use the <code><inherited></code> tag:</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <build> <plugins> @@ -636,7 +636,7 @@ public class MyBoundQueryMojo </plugins> </build> ... -</project></code></pre></section></section><section> +</project></pre></div></section></section><section> <h2><a id="Configuring_Reporting_Plugins">Configuring Reporting Plugins</a></h2> <p>The following is only to configure Reporting plugins in the <code><reporting></code> element.</p><section> <h3><a id="Using_the_.3Creporting.3E_Tag_VS_.3Cbuild.3E_Tag">Using the <code><reporting></code> Tag VS <code><build></code> Tag</a></h3> @@ -648,7 +648,7 @@ public class MyBoundQueryMojo <dd>It <b>ignores</b> the parameters defined in the <code><configuration></code> element of each reporting Plugin specified in the <code><reporting></code> element; only parameters defined in the <code><configuration></code> element of each plugin specified in <code><build></code> are used.</dd></dl></section><section> <h3><a id="Using_the_.3CreportSets.3E_Tag">Using the <code><reportSets></code> Tag</a></h3> <p>You can configure a reporting plugin using the <code><reportSets></code> tag. This is most commonly used to generate reports selectively when running <code>mvn site</code>. The following will generate only the project team report.</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <reporting> <plugins> @@ -667,19 +667,19 @@ public class MyBoundQueryMojo </plugins> </reporting> ... -</project></code></pre> +</project></pre></div> <p><b>Notes</b>:</p> -<ol style="list-style-type: decimal;"> +<ol style="list-style-type: decimal"> <li>To exclude all reports, you need to use: -<pre><code> <reportSets> +<div class="verbatim source"><pre class="prettyprint linenums"> <reportSets> <reportSet> <reports/> </reportSet> - </reportSets></code></pre></li> + </reportSets></pre></div></li> <li>Refer to each Plugin Documentation (i.e. plugin-info.html) to know the available report goals.</li></ol></section><section> <h3><a id="Using_the_.3Cinherited.3E_Tag_In_Reporting_Plugins">Using the <code><inherited></code> Tag In Reporting Plugins</a></h3> <p>Similar to the build plugins, to break the inheritance, you can use the <code><inherited></code> tag:</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <reporting> <plugins> @@ -692,7 +692,7 @@ public class MyBoundQueryMojo </plugins> </reporting> ... -</project></code></pre></section></section></section> +</project></pre></div></section></section></section> </main> </div> </div>
Modified: maven/website/content/guides/mini/guide-creating-archetypes.html ============================================================================== --- maven/website/content/guides/mini/guide-creating-archetypes.html (original) +++ maven/website/content/guides/mini/guide-creating-archetypes.html Sun May 12 07:42:36 2024 @@ -2,17 +2,17 @@ <!-- - | Generated by Apache Maven Doxia Site Renderer 2.0.0-M18 from content/apt/guides/mini/guide-creating-archetypes.apt at 2024-05-11 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M10 from content/apt/guides/mini/guide-creating-archetypes.apt at 2024-05-12 | Rendered using Apache Maven Fluido Skin 2.0.0-M6 --> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <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-M18" /> + <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0-M10" /> <meta name="author" content="Jason van Zyl, Alexander Hars, Franz Allan Valencia See" /> <meta name="date" content="2010-04-10" /> - <title>Maven</title> + <title>Maven â Guide to Creating Archetypes</title> <link rel="stylesheet" href="../../css/apache-maven-fluido-2.0.0-M6.min.css" /> <link rel="stylesheet" href="../../css/site.css" /> <link rel="stylesheet" href="../../css/print.css" media="print" /> @@ -39,10 +39,8 @@ <div class="container-fluid"> <header> <div id="banner"> - <div class="pull-left"><a href="https://www.apache.org/" id="bannerLeft"><h1>Apache Maven Site</h1> -</a></div> - <div class="pull-right"><a href="../.././" id="bannerRight"><h1>$esc.xml( $banner.name )</h1> -</a></div> + <div class="pull-left"><a href="https://www.apache.org/" id="bannerLeft"><img src="../../images/apache-maven-project.png" alt="Apache Maven Site" style="" /></a></div> + <div class="pull-right"><a href="../.././" id="bannerRight"><img src="../../images/maven-logo-black-on-white.png" alt="" style="" /></a></div> <div class="clear"><hr/></div> </div> @@ -50,9 +48,8 @@ <ul class="breadcrumb"> <li><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> <li><a href="../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> - - <li class="active ">Maven <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-creating-archetypes.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> - <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2024-05-11</li> + <li class="active ">Guide to Creating Archetypes <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-creating-archetypes.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2024-05-12</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> @@ -149,7 +146,7 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section><a id="Guide_to_Creating_Archetypes"></a> +<section> <h1>Guide to Creating Archetypes</h1> <p>Creating an archetype is a pretty straight forward process. An archetype is a very simple artifact, that contains the project prototype you wish to create. An archetype is made up of:</p> <ul> @@ -157,10 +154,10 @@ <li>the prototype files that are copied by the archetype plugin (directory: <code>src/main/resources/archetype-resources/</code>)</li> <li>the prototype pom (<code>pom.xml</code> in: <code>src/main/resources/archetype-resources</code>)</li> <li>a pom for the archetype (<code>pom.xml</code> in the archetype's root directory).</li></ul> -<p>To create an archetype follow these steps:</p><section><a id="a1._Create_a_new_project_and_pom.xml_for_the_archetype_artifact"></a> +<p>To create an archetype follow these steps:</p><section> <h2>1. Create a new project and pom.xml for the archetype artifact</h2> <p>An example <code>pom.xml</code> for an archetype artifact looks as follows:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -180,11 +177,11 @@ </extensions> </build> </project> -</code></pre> -<p>All you need to specify is a <code>groupId</code>, <code>artifactId</code> and <code>version</code>. These three parameters will be needed later for invoking the archetype via <code>archetype:generate</code> from the commandline.</p></section><section><a id="a2._Create_the_archetype_descriptor"></a> +</pre></div> +<p>All you need to specify is a <code>groupId</code>, <code>artifactId</code> and <code>version</code>. These three parameters will be needed later for invoking the archetype via <code>archetype:generate</code> from the commandline.</p></section><section> <h2>2. Create the archetype descriptor</h2> <p>The <a href="/archetype/archetype-models/archetype-descriptor/archetype-descriptor.html">archetype descriptor</a> is a file called <code>archetype-metadata.xml</code> which must be located in the <code>src/main/resources/META-INF/maven/</code> directory. An example of an archetype descriptor can be found in the quickstart archetype:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <archetype-descriptor xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0 https://maven.apache.org/xsd/archetype-descriptor-1.1.0.xsd" @@ -198,7 +195,7 @@ </fileSet> </fileSets> </archetype-descriptor> -</code></pre> +</pre></div> <p>The attribute <code>name</code> tag should be the same as the <code>artifactId</code> in the archetype <code>pom.xml</code>.</p> <p>The boolean attribute <code>partial</code> show if this archetype is representing a full Maven project or only parts.</p> <p>The <code>requiredProperties</code>, <code>fileSets</code> and <code>modules</code> tags represent the differents parts of the project:</p> @@ -208,6 +205,7 @@ <li><code><modules></code> : Modules definition</li></ul> <p>At this point one can only specify individual files to be created but not empty directories.</p> <p>Thus the quickstart archetype shown above defines the following directory structure:</p> +<div class="verbatim"> <pre> archetype |-- pom.xml @@ -226,11 +224,11 @@ archetype `-- test `-- java `-- AppTest.java -</pre></section><section><a id="a3._Create_the_prototype_files_and_the_prototype_pom.xml"></a> +</pre></div></section><section> <h2>3. Create the prototype files and the prototype pom.xml</h2> <p>The next component of the archetype to be created is the prototype <code>pom.xml</code>. Any <code>pom.xml</code> will do, just don't forget to the set <code>artifactId</code> and <code>groupId</code> as variables ( <code>${artifactId}</code> / <code>${groupId}</code> ). Both variables will be initialized from the commandline when calling <code>archetype:generate</code>.</p> <p>An example for a prototype <code>pom.xml</code> is:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -252,13 +250,15 @@ archetype </dependency> </dependencies> </project> -</code></pre></section><section><a id="a4._Install_the_archetype_and_run_the_archetype_plugin"></a> +</pre></div></section><section> <h2>4. Install the archetype and run the archetype plugin</h2> <p>Now you are ready to install the archetype:</p> +<div class="verbatim"> <pre> mvn install -</pre> +</pre></div> <p>Now that you have created an archetype, you can try it on your local system by using the following command. In this command, you need to specify the full information about the archetype you want to use (its <code>groupId</code>, its <code>artifactId</code>, its <code>version</code>) and the information about the new project you want to create (<code>artifactId</code> and <code>groupId</code>). Don't forget to include the version of your archetype (if you don't include the version, you archetype creation may fail with a message that version:RELEASE was not found)</p> +<div class="verbatim"> <pre> mvn archetype:generate \ -DarchetypeGroupId=<archetype-groupId> \ @@ -266,15 +266,16 @@ mvn archetype:generate -DarchetypeVersion=<archetype-version> \ -DgroupId=<my.groupid> \ -DartifactId=<my-artifactId> -</pre> -<p>Once you are happy with the state of your archetype, you can deploy (or submit it to <a href="/guides/mini/guide-central-repository-upload.html">Maven Central</a>) it as any other artifact and the archetype will then be available to any user of Maven.</p></section><section><a id="Alternative_way_to_start_creating_your_Archetype"></a> +</pre></div> +<p>Once you are happy with the state of your archetype, you can deploy (or submit it to <a href="/guides/mini/guide-central-repository-upload.html">Maven Central</a>) it as any other artifact and the archetype will then be available to any user of Maven.</p></section><section> <h2>Alternative way to start creating your Archetype</h2> <p>Instead of manually creating the directory structure needed for an archetype, simply use</p> +<div class="verbatim"> <pre>mvn archetype:generate -DgroupId=[your project's group id] -DartifactId=[your project's artifact id] -DarchetypeGroupId=org.apache.maven.archetypes - -DarchetypeArtifactId=maven-archetype-archetype</pre> + -DarchetypeArtifactId=maven-archetype-archetype</pre></div> <p>Afterwhich, you can now customize the contents of the <code>archetype-resources</code> directory, and <code>archetype-metadata.xml</code>, then, proceed to Step#4 (Install the archetype and run the archetype plugin).</p></section></section> </main> </div> Modified: maven/website/content/guides/mini/guide-default-execution-ids.html ============================================================================== --- maven/website/content/guides/mini/guide-default-execution-ids.html (original) +++ maven/website/content/guides/mini/guide-default-execution-ids.html Sun May 12 07:42:36 2024 @@ -2,17 +2,17 @@ <!-- - | Generated by Apache Maven Doxia Site Renderer 2.0.0-M18 from content/apt/guides/mini/guide-default-execution-ids.apt at 2024-05-11 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M10 from content/apt/guides/mini/guide-default-execution-ids.apt at 2024-05-12 | Rendered using Apache Maven Fluido Skin 2.0.0-M6 --> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <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-M18" /> + <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0-M10" /> <meta name="author" content="John Casey" /> <meta name="date" content="2009-06-10" /> - <title>Maven</title> + <title>Maven â Guide to Configuring Default Mojo Executions</title> <link rel="stylesheet" href="../../css/apache-maven-fluido-2.0.0-M6.min.css" /> <link rel="stylesheet" href="../../css/site.css" /> <link rel="stylesheet" href="../../css/print.css" media="print" /> @@ -39,10 +39,8 @@ <div class="container-fluid"> <header> <div id="banner"> - <div class="pull-left"><a href="https://www.apache.org/" id="bannerLeft"><h1>Apache Maven Site</h1> -</a></div> - <div class="pull-right"><a href="../.././" id="bannerRight"><h1>$esc.xml( $banner.name )</h1> -</a></div> + <div class="pull-left"><a href="https://www.apache.org/" id="bannerLeft"><img src="../../images/apache-maven-project.png" alt="Apache Maven Site" style="" /></a></div> + <div class="pull-right"><a href="../.././" id="bannerRight"><img src="../../images/maven-logo-black-on-white.png" alt="" style="" /></a></div> <div class="clear"><hr/></div> </div> @@ -50,9 +48,8 @@ <ul class="breadcrumb"> <li><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> <li><a href="../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> - - <li class="active ">Maven <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-default-execution-ids.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> - <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2024-05-11</li> + <li class="active ">Guide to Configuring Default Mojo Executions <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-default-execution-ids.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2024-05-12</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> @@ -150,7 +147,7 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section><a id="Guide_to_Configuring_Default_Mojo_Executions"></a> +<section> <h1>Guide to Configuring Default Mojo Executions</h1> <p>In most cases where you need to configure a plugin, there are two options that work well: plugin-level configuration and execution-level configuration. Plugin-level configuration is the most common method for configuring plugins that will be used from the command line, are defined as part of the default lifecycle, or that use a common configuration across all invocations. In fact, for direct invocation from the command line, plugin-level configuration has been the <i>only</i> option historically.</p> <p>On the other hand, in cases where a more advanced build process requires the execution of mojos - sometimes the same mojos, sometimes different ones - from a single plugin that use different configurations, the execution-level configuration is most commonly used. These cases normally involve plugins that are introduced as part of the standard build process, but which aren't present in the default lifecycle mapping for that particular packaging. In these cases, common settings shared between executions are still normally specified in the plugin-level configuration.</p> @@ -158,13 +155,13 @@ <ul> <li>Mojos run from the command line <i>and</i> during the build, when the CLI-driven invocation requires its own configuration.</li> <li>Mojo executions that are bound to the lifecycle as part of the default mapping for a particular packaging, especially in cases where the same mojos need to be added to a second execution with different configuration.</li> -<li>Groups of mojos from the same plugin that are bound to the lifecycle as part of the default mapping for a particular packaging, but require separate configurations.</li></ul><section><a id="Default_executionIds_for_Implied_Executions"></a> +<li>Groups of mojos from the same plugin that are bound to the lifecycle as part of the default mapping for a particular packaging, but require separate configurations.</li></ul><section> <h2>Default <code>executionId</code>s for Implied Executions</h2> -<p>When you consider the fact that the aforementioned configuration use cases are for mojos that are not explicitly mentioned in the POM, it's reasonable to refer to them as implied executions. But if they're implied, how can Maven allow users to provide configuration for them? The solution we've implemented is rather simple and low-tech, but should be more than adequate to handle even advanced use cases. Starting in Maven 2.2.0, each mojo invoked directly from the command line will have an execution Id of <code>default-cli</code> assigned to it, which will allow the configuration of that execution from the POM by using this default execution Id. Likewise, each mojo bound to the build lifecycle via the default lifecycle mapping for the specified POM packaging will have an execution Id of <code>default-<goalName></code> assigned to it, to allow configuration of each default mojo execution independently.</p><section><a id="Example.3A_Command-line_variant_invocation_of_the_assemb ly_plugin"></a> +<p>When you consider the fact that the aforementioned configuration use cases are for mojos that are not explicitly mentioned in the POM, it's reasonable to refer to them as implied executions. But if they're implied, how can Maven allow users to provide configuration for them? The solution we've implemented is rather simple and low-tech, but should be more than adequate to handle even advanced use cases. Starting in Maven 2.2.0, each mojo invoked directly from the command line will have an execution Id of <code>default-cli</code> assigned to it, which will allow the configuration of that execution from the POM by using this default execution Id. Likewise, each mojo bound to the build lifecycle via the default lifecycle mapping for the specified POM packaging will have an execution Id of <code>default-<goalName></code> assigned to it, to allow configuration of each default mojo execution independently.</p><section> <h3>Example: Command-line variant invocation of the assembly plugin</h3> <p>Consider the case where the user wants to execute the <code>assembly:assembly</code> mojo directly on the command line, but already has a configuration for the <code>assembly:single</code> mojo that runs during the main build lifecycle. Since these configurations require different options, the user cannot use the plugin-level configuration section to specify common elements.</p> <p>In this case, the assembly-plugin configuration might look like this:</p> -<pre><code><plugin> +<div class="verbatim source"><pre class="prettyprint linenums"><plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <tarLongFileMode>gnu</tarLongFileMode> @@ -193,14 +190,14 @@ </configuration> </execution> </executions> -</plugin></code></pre> +</plugin></pre></div> <p>In the above example, you can see several interesting things. First, the main build process will invoke the <code>assembly:single</code> mojo during the <code>package</code> phase of the build, and produce both binary and source distribution artifacts using custom assembly descriptors included with the project. Second, all invocations of the assembly plugin should use a <code>tarLongFileMode</code> strategy of <code>gnu</code>. Finally, when the assembly plugin is invoked from the command line, it will build the standard <code>jar-with-dependencies</code> and <code>project</code> artifacts for the project, and ignore the custom assembly descriptors in <code>src/main/assembly</code>.</p> -<p>Now, notice the difference in the way the two execution blocks reference assembly descriptors. One uses custom descriptors via the <code>descriptors</code> section, and the other uses standard descriptors via the <code>descriptorRefs</code> section. These two sections cannot override one another, so it's impossible to setup one section - say, <code>descriptorRefs</code> - in the plugin-level configuration block (to provide CLI access to it, as historical versions of Maven would require), then have the <code>build-distros</code> invocation override it with the custom descriptors specified in the <code>descriptors</code> section.</p></section><section><a id="Example.3A_Configuring_compile_to_run_twice"></a> +<p>Now, notice the difference in the way the two execution blocks reference assembly descriptors. One uses custom descriptors via the <code>descriptors</code> section, and the other uses standard descriptors via the <code>descriptorRefs</code> section. These two sections cannot override one another, so it's impossible to setup one section - say, <code>descriptorRefs</code> - in the plugin-level configuration block (to provide CLI access to it, as historical versions of Maven would require), then have the <code>build-distros</code> invocation override it with the custom descriptors specified in the <code>descriptors</code> section.</p></section><section> <h3>Example: Configuring <code>compile</code> to run twice</h3> <p>In this scenario, the user wants to run the <code>compiler:compile</code> mojo twice for his <code>jar</code> packaging project. The main reason for this is to provide an entry point into the application that will warn the user if he's using a Java version older than 1.5, then exit gracefully. Without such an entry point, the user would be confronted with a stacktrace in the event he tried to run this application with a 1.4 or older JRE.</p> <p>Therefore, the user needs to compile the bulk of his application to target the 1.5 Java specification, then compile the rest (the entry point) to target an older specification...say, 1.3. The first execution will specify the <code>source</code> and <code>target</code> values at <code>1.5</code>, and add an <code>excludes</code> section to avoid compiling the entry point for the application. The second pass will then re-specify <code>source</code> and <code>target</code> to <code>1.3</code>, and basically invert the original <code>excludes</code> section to be an <code>includes</code> section, so as to compile <i>only</i> the entry point class.</p> <p>The resulting configuration might look something like this:</p> -<pre><code><plugin> +<div class="verbatim source"><pre class="prettyprint linenums"><plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> @@ -230,16 +227,16 @@ </configuration> </execution> </executions> -</plugin></code></pre> +</plugin></pre></div> <p>There are three important things to notice in the above compiler-plugin configuration:</p> <ul> <li>The default <code>source</code> and <code>target</code> compatibility levels are for Java 1.5. This means that the compiler will generate binaries for Java 1.5 from both the main codebase and the test codebase, unless otherwise overridden.</li> <li>The default pass of the <code>compile</code> goal will <i>exclude</i> the <code>**/cli/*</code> path pattern, but will compile everything else in <code>src/main/java</code> to run under Java 1.5.</li> -<li>The second pass of the <code>compile</code> mojo - in the execution called <code>build-java14-cli</code> - resets the <code>source</code> and <code>target</code> versions to <code>1.3</code>, and inverts the exclude rule from the first pass. This means the second time around, the compiler will produce 1.4-targeted binaries for the classes matching the <code>**/cli/*</code> path pattern.</li></ul></section><section><a id="Example.3A_Configuring_compile_and_testCompile_mojos_separately"></a> +<li>The second pass of the <code>compile</code> mojo - in the execution called <code>build-java14-cli</code> - resets the <code>source</code> and <code>target</code> versions to <code>1.3</code>, and inverts the exclude rule from the first pass. This means the second time around, the compiler will produce 1.4-targeted binaries for the classes matching the <code>**/cli/*</code> path pattern.</li></ul></section><section> <h3>Example: Configuring <code>compile</code> and <code>testCompile</code> mojos separately</h3> <p>Finally, building on our use of the compiler plugin to tease out these different use cases, consider the case where a user wants to target version 1.4 of the Java specification as his runtime platform. However, he still wants the convenience and other advantages to be found in a unit-testing framework like TestNG. This forces the user to configure the <code>compile</code> mojo with one set of <code>source</code> and <code>target</code> values - specifically, <code>1.4</code> - and the <code>testCompile</code> mojo with another (<code>1.5</code>).</p> <p>The resulting compiler-plugin configuration might look something like the following:</p> -<pre><code><plugin> +<div class="verbatim source"><pre class="prettyprint linenums"><plugin> <artifactId>maven-compiler-plugin</artifactId> <executions> <execution> @@ -257,7 +254,7 @@ </configuration> </execution> </executions> -</plugin></code></pre> +</plugin></pre></div> <p>This example is fairly simple and straightforward. First, the <code>default-compile</code> execution sets the <code>source</code> and <code>target</code> values to <code>1.3</code> to allow older Java versions to run the project. Then, the <code>default-testCompile</code> execution resets the <code>source</code> and <code>target</code> values to <code>1.5</code>, which enables the project to use tools like TestNG that use annotations.</p> <p>Incidentally, it's perhaps useful to point out that the example above is a little bit contrived; the compiler plugin targets Java 1.3 by default, so the only configuration that's really required is the <code>default-testCompile</code> execution. The <code>default-compile</code> execution respecifies plugin defaults. The only time this might be useful is when a parent POM defines a plugin-level configuration for <code>source</code> and <code>target</code> that needs to be changed for the purposes of these different compiler executions. This example is meant to be illustrative of the potential for separate configuration of default lifecycle mojos.</p></section></section></section> </main> Modified: maven/website/content/guides/mini/guide-deployment-security-settings.html ============================================================================== --- maven/website/content/guides/mini/guide-deployment-security-settings.html (original) +++ maven/website/content/guides/mini/guide-deployment-security-settings.html Sun May 12 07:42:36 2024 @@ -2,17 +2,17 @@ <!-- - | Generated by Apache Maven Doxia Site Renderer 2.0.0-M18 from content/apt/guides/mini/guide-deployment-security-settings.apt at 2024-05-11 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M10 from content/apt/guides/mini/guide-deployment-security-settings.apt at 2024-05-12 | Rendered using Apache Maven Fluido Skin 2.0.0-M6 --> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <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-M18" /> + <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0-M10" /> <meta name="author" content="Jason van Zyl" /> <meta name="date" content="2005-10-12" /> - <title>Maven</title> + <title>Maven â Guide to Deployment and Security Settings</title> <link rel="stylesheet" href="../../css/apache-maven-fluido-2.0.0-M6.min.css" /> <link rel="stylesheet" href="../../css/site.css" /> <link rel="stylesheet" href="../../css/print.css" media="print" /> @@ -39,10 +39,8 @@ <div class="container-fluid"> <header> <div id="banner"> - <div class="pull-left"><a href="https://www.apache.org/" id="bannerLeft"><h1>Apache Maven Site</h1> -</a></div> - <div class="pull-right"><a href="../.././" id="bannerRight"><h1>$esc.xml( $banner.name )</h1> -</a></div> + <div class="pull-left"><a href="https://www.apache.org/" id="bannerLeft"><img src="../../images/apache-maven-project.png" alt="Apache Maven Site" style="" /></a></div> + <div class="pull-right"><a href="../.././" id="bannerRight"><img src="../../images/maven-logo-black-on-white.png" alt="" style="" /></a></div> <div class="clear"><hr/></div> </div> @@ -50,9 +48,8 @@ <ul class="breadcrumb"> <li><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> <li><a href="../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> - - <li class="active ">Maven <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-deployment-security-settings.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> - <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2024-05-11</li> + <li class="active ">Guide to Deployment and Security Settings <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-deployment-security-settings.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2024-05-12</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> @@ -162,12 +159,12 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section><a id="Security_and_Deployment_Settings"></a> +<section> <h1>Security and Deployment Settings</h1> <p>Repositories to deploy to are defined in a project in the <code>distributionManagement</code> section. However, you cannot put your username, password, or other security settings in that project. For that reason, you should add a server definition to your own settings with an id that matches that of the deployment repository in the project.</p> <p>In addition, some repositories may require authorisation to download from, so the corresponding settings can be specified in a server element in the same way.</p> <p>Which settings are required will depend on the type of repository you are deploying to. As of the first release, only SCP deployments and file deployments are supported by default, so only the following SCP configuration is needed:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <settings> . . @@ -185,7 +182,7 @@ . . </settings> -</code></pre> +</pre></div> <p>To encrypt passwords in these sections, refer to <a href="./guide-encryption.html"> Encryption Settings</a>.</p> <p><b>Note</b>: The settings descriptor documentation can be found on the <a href="../../maven-settings/settings.html">Maven Local Settings Model Website</a>.</p></section> </main> Modified: maven/website/content/guides/mini/guide-encryption.html ============================================================================== --- maven/website/content/guides/mini/guide-encryption.html (original) +++ maven/website/content/guides/mini/guide-encryption.html Sun May 12 07:42:36 2024 @@ -2,18 +2,18 @@ <!-- - | Generated by Apache Maven Doxia Site Renderer 2.0.0-M18 from content/apt/guides/mini/guide-encryption.apt at 2024-05-11 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M10 from content/apt/guides/mini/guide-encryption.apt at 2024-05-12 | Rendered using Apache Maven Fluido Skin 2.0.0-M6 --> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <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-M18" /> + <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0-M10" /> <meta name="author" content="Oleg Gusakov" /> <meta name="author" content="Robert Scholte" /> <meta name="date" content="2014-03-23" /> - <title>Maven</title> + <title>Maven â Password Encryption</title> <link rel="stylesheet" href="../../css/apache-maven-fluido-2.0.0-M6.min.css" /> <link rel="stylesheet" href="../../css/site.css" /> <link rel="stylesheet" href="../../css/print.css" media="print" /> @@ -40,10 +40,8 @@ <div class="container-fluid"> <header> <div id="banner"> - <div class="pull-left"><a href="https://www.apache.org/" id="bannerLeft"><h1>Apache Maven Site</h1> -</a></div> - <div class="pull-right"><a href="../.././" id="bannerRight"><h1>$esc.xml( $banner.name )</h1> -</a></div> + <div class="pull-left"><a href="https://www.apache.org/" id="bannerLeft"><img src="../../images/apache-maven-project.png" alt="Apache Maven Site" style="" /></a></div> + <div class="pull-right"><a href="../.././" id="bannerRight"><img src="../../images/maven-logo-black-on-white.png" alt="" style="" /></a></div> <div class="clear"><hr/></div> </div> @@ -51,9 +49,8 @@ <ul class="breadcrumb"> <li><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> <li><a href="../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> - - <li class="active ">Maven <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-encryption.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> - <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2024-05-11</li> + <li class="active ">Password Encryption <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-encryption.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2024-05-12</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> @@ -165,7 +162,7 @@ <main id="bodyColumn" class="span10" > <section> <h1><a id="Password_Encryption">Password Encryption</a></h1> -<ol style="list-style-type: decimal;"> +<ol style="list-style-type: decimal"> <li><a href="#Introduction">Introduction</a></li> <li><a href="#How_to_create_a_master_password">How to create a master password</a></li> <li><a href="#How_to_encrypt_server_passwords">How to encrypt server passwords</a></li> @@ -191,23 +188,27 @@ <li>for now - this is done via CLI <b>after</b> master password has been created and stored in appropriate location</li></ul></li></ul></section><section> <h2><a id="How_to_create_a_master_password">How to create a master password</a></h2> <p>Use the following command line:</p> -<pre>mvn --encrypt-master-password <password></pre> +<div class="verbatim"> +<pre>mvn --encrypt-master-password <password></pre></div> <p><i>Note:</i> Since Maven 3.2.1 the password argument should no longer be used (see <a href="#Tips">Tips</a> below for more information). Maven will prompt for the password. Earlier versions of Maven will not prompt for a password, so it must be typed on the command-line in plaintext.</p> <p>This command will produce an encrypted version of the password, something like</p> -<pre>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}</pre> +<div class="verbatim"> +<pre>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}</pre></div> <p>Store this password in the <code>${user.home}/.m2/settings-security.xml</code>; it should look like</p> -<pre><code><settingsSecurity> +<div class="verbatim source"><pre class="prettyprint linenums"><settingsSecurity> <master>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}</master> -</settingsSecurity></code></pre> +</settingsSecurity></pre></div> <p>When this is done, you can start encrypting existing server passwords.</p></section><section> <h2><a id="How_to_encrypt_server_passwords">How to encrypt server passwords</a></h2> <p>You have to use the following command line:</p> -<pre>mvn --encrypt-password <password></pre> +<div class="verbatim"> +<pre>mvn --encrypt-password <password></pre></div> <p><i>Note:</i>Just like <code>--encrypt-master-password</code> the password argument should no longer be used since Maven 3.2.1 (see <a href="#Tips">Tips below for more information.</a>).</p> <p>This command produces an encrypted version of it, something like</p> -<pre>{COQLCE6DU6GtcS5P=}</pre> +<div class="verbatim"> +<pre>{COQLCE6DU6GtcS5P=}</pre></div> <p>Copy and paste it into the servers section of your <code>settings.xml</code> file. This will look like:</p> -<pre><code><settings> +<div class="verbatim source"><pre class="prettyprint linenums"><settings> ... <servers> ... @@ -219,9 +220,9 @@ ... </servers> ... -</settings></code></pre> +</settings></pre></div> <p>Please note that password can contain any information outside of the curly brackets, so that the following will still work:</p> -<pre><code><settings> +<div class="verbatim source"><pre class="prettyprint linenums"><settings> ... <servers> ... @@ -233,42 +234,47 @@ ... </servers> ... -</settings></code></pre> +</settings></pre></div> <p>Then you can use, say, deploy plugin, to write to this server:</p> +<div class="verbatim"> <pre>mvn deploy:deploy-file -Durl=https://maven.corp.com/repo \ -DrepositoryId=my.server \ - -Dfile=your-artifact-1.0.jar \</pre></section><section> + -Dfile=your-artifact-1.0.jar \</pre></div></section><section> <h2><a id="How_to_keep_the_master_password_on_removable_drive">How to keep the master password on removable drive</a></h2> <p>Create the master password exactly as described above, and store it on a removable drive, for instance on OSX, my USB drive mounts as <code>/Volumes/mySecureUsb</code>, so I store</p> -<pre><code><settingsSecurity> +<div class="verbatim source"><pre class="prettyprint linenums"><settingsSecurity> <master>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+9EF1iFQyJQ=}</master> -</settingsSecurity></code></pre> +</settingsSecurity></pre></div> <p>in the file <code>/Volumes/mySecureUsb/secure/settings-security.xml</code></p> <p>And then I create <code>${user.home}/.m2/settings-security.xml</code> with the following content:</p> -<pre><code><settingsSecurity> +<div class="verbatim source"><pre class="prettyprint linenums"><settingsSecurity> <relocation>/Volumes/mySecureUsb/secure/settings-security.xml</relocation> -</settingsSecurity></code></pre> +</settingsSecurity></pre></div> <p>This assures that encryption only works when the USB drive is mounted by the OS. This addresses a use case where only certain people are authorized to deploy and are issued these devices.</p></section><section> -<h2><a id="Tips">Tips</a></h2><section><a id="Escaping_curly-brace_literals_in_your_password_.28Since.3A_Maven_2.2.0.29"></a> +<h2><a id="Tips">Tips</a></h2><section> <h3>Escaping curly-brace literals in your password <i>(Since: Maven 2.2.0)</i></h3> <p>At times, you might find that your password (or the encrypted form of it) contains '{' or '}' as a literal value. If you added such a password as-is to your settings.xml file, you would find that Maven does strange things with it. Specifically, Maven treats all the characters preceding the '{' literal, and all the characters after the '}' literal, as comments. Obviously, this is not the behavior you want. What you really need is a way of <b>escaping</b> the curly-brace literals in your password.</p> <p>You can do this with the widely used '\' escape character. If your password looks like this:</p> -<pre>jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+{EF1iFQyJQ=</pre> +<div class="verbatim"> +<pre>jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+{EF1iFQyJQ=</pre></div> <p>Then, the value you would add to your settings.xml looks like this:</p> -<pre>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+\{EF1iFQyJQ=}</pre></section><section><a id="Password_Security"></a> +<div class="verbatim"> +<pre>{jSMOWnoPFgsHVpMvz5VrIt5kRbzGpI8u+\{EF1iFQyJQ=}</pre></div></section><section> <h3>Password Security</h3> <p>Editing <code>settings.xml</code> and running the above commands can still leave your password stored locally in plaintext. You may want to check the following locations:</p> <ul> <li>Shell history (e.g. by running <code>history</code>). You may want to clear your history after encrypting the above passwords</li> <li>Editor caches (e.g. <code>~/.viminfo</code>)</li></ul> -<p>Also note that the encrypted passwords can be decrypted by someone that has the master password and settings security file. Keep this file secure (or stored separately) if you expect the possibility that the <code>settings.xml</code> file may be retrieved.</p></section><section><a id="Password_Escaping_on_different_platforms"></a> +<p>Also note that the encrypted passwords can be decrypted by someone that has the master password and settings security file. Keep this file secure (or stored separately) if you expect the possibility that the <code>settings.xml</code> file may be retrieved.</p></section><section> <h3>Password Escaping on different platforms</h3> <p>On some platforms it might be necessary to quote the password if it contains special characters like <code>%</code>, <code>!</code>, <code>$</code>, etc. For example on Windows you have to be careful about things like the following:</p> <p>The following example will not work on Windows:</p> -<pre>mvn --encrypt-master-password a!$%^b</pre> +<div class="verbatim"> +<pre>mvn --encrypt-master-password a!$%^b</pre></div> <p>whereas the following will work on Windows:</p> -<pre>mvn --encrypt-master-password "a!$%^b"</pre> -<p>If you are on a linux/unix platform you should use single quotes for the above master password. Otherwise the master password will not work (caused by the dollar sign and the exclamation mark).</p></section><section><a id="Prompting_for_Password"></a> +<div class="verbatim"> +<pre>mvn --encrypt-master-password "a!$%^b"</pre></div> +<p>If you are on a linux/unix platform you should use single quotes for the above master password. Otherwise the master password will not work (caused by the dollar sign and the exclamation mark).</p></section><section> <h3>Prompting for Password</h3> <p>In Maven before version 3.2.1 you have to give the password on the command line as an argument which means you might need to escape your password. In addition usually the shell stores the full history of commands you have entered, therefore anyone with access to your computer could restore the password from the shell`s history.</p> <p>Starting with Maven 3.2.1, the password is an optional argument. If you omit the password, you will be prompted for it which prevents all the issues mentioned above.</p> Modified: maven/website/content/guides/mini/guide-generating-sources.html ============================================================================== --- maven/website/content/guides/mini/guide-generating-sources.html (original) +++ maven/website/content/guides/mini/guide-generating-sources.html Sun May 12 07:42:36 2024 @@ -2,19 +2,19 @@ <!-- - | Generated by Apache Maven Doxia Site Renderer 2.0.0-M18 from content/apt/guides/mini/guide-generating-sources.apt at 2024-05-11 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M10 from content/apt/guides/mini/guide-generating-sources.apt at 2024-05-12 | Rendered using Apache Maven Fluido Skin 2.0.0-M6 --> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <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-M18" /> + <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0-M10" /> <meta name="author" content="Jason van Zyl" /> <meta name="author" content="Karl Heinz Marbaise" /> <meta name="date" content="2005-10-12 2016-06-11" /> - <title>Maven</title> + <title>Maven â Guide to generating Sources</title> <link rel="stylesheet" href="../../css/apache-maven-fluido-2.0.0-M6.min.css" /> <link rel="stylesheet" href="../../css/site.css" /> <link rel="stylesheet" href="../../css/print.css" media="print" /> @@ -41,10 +41,8 @@ <div class="container-fluid"> <header> <div id="banner"> - <div class="pull-left"><a href="https://www.apache.org/" id="bannerLeft"><h1>Apache Maven Site</h1> -</a></div> - <div class="pull-right"><a href="../.././" id="bannerRight"><h1>$esc.xml( $banner.name )</h1> -</a></div> + <div class="pull-left"><a href="https://www.apache.org/" id="bannerLeft"><img src="../../images/apache-maven-project.png" alt="Apache Maven Site" style="" /></a></div> + <div class="pull-right"><a href="../.././" id="bannerRight"><img src="../../images/maven-logo-black-on-white.png" alt="" style="" /></a></div> <div class="clear"><hr/></div> </div> @@ -52,9 +50,8 @@ <ul class="breadcrumb"> <li><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> <li><a href="../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> - - <li class="active ">Maven <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-generating-sources.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> - <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2024-05-11</li> + <li class="active ">Guide to generating Sources <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/mini/guide-generating-sources.apt"><img src="../../images/accessories-text-editor.png" title="Edit" /></a></li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2024-05-12</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> @@ -165,10 +162,10 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section><a id="Guide_to_generating_sources"></a> +<section> <h1>Guide to generating sources</h1> <p>Let's run though a short example. To generate sources you must first have a plugin that participates in the <code>generate-sources</code> phase like the <a class="externalLink" href="https://www.antlr.org/api/maven-plugin/latest/">ANTLR4 Maven Plugin</a>. You configure its execution in the POM:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> ... <build> @@ -190,7 +187,7 @@ </build> ... </project> -</code></pre> +</pre></div> <p>When you type <code>mvn compile</code>, Maven walks through the <a href="../introduction/introduction-to-the-lifecycle.html">lifecycle</a> and eventually hits the <code>generate-sources</code> phase. It sees that a plugin is configured that wants to participate in that phase, and executes the ANTLR4 Maven Plugin with the given configuration. Later, during the compile phase, all the code generated from the grammar files is compiled without further configuration.</p></section> </main> </div>