Modified: maven/website/content/guides/getting-started/windows-prerequisites.html ============================================================================== --- maven/website/content/guides/getting-started/windows-prerequisites.html (original) +++ maven/website/content/guides/getting-started/windows-prerequisites.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/getting-started/windows-prerequisites.apt at 2024-05-11 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M10 from content/apt/guides/getting-started/windows-prerequisites.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="Benson Margulies" /> <meta name="date" content="2012-07-01" /> - <title>Maven</title> + <title>Maven â Maven on Windows</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/getting-started/windows-prerequisites.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 ">Maven on Windows <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/getting-started/windows-prerequisites.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> @@ -131,18 +128,19 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section><a id="Maven_on_Windows"></a> +<section> <h1>Maven on Windows</h1> -<p>Maven is a command-line tool for building Java (and other) programs. The Maven project provides a simple ZIP file containing a precompiled version of Maven for your convenience. There is no installer. It's up to you to set up your prerequisites and environment to run Maven on Windows.</p><section><a id="Prerequisites"></a> +<p>Maven is a command-line tool for building Java (and other) programs. The Maven project provides a simple ZIP file containing a precompiled version of Maven for your convenience. There is no installer. It's up to you to set up your prerequisites and environment to run Maven on Windows.</p><section> <h2>Prerequisites</h2> <p>Maven is written in Java (and primarily used to build Java programs). Thus, the major prerequisite is the Java SDK. You need to install the Java SDK (e.g. from <a class="externalLink" href="https://www.oracle.com/technetwork/java/javase/downloads/index.html">Oracle's download site</a>).</p> <p>Once Java is installed, you must ensure that the commands from the Java SDK are in your PATH environment variable. Running, for example,</p> -<pre>java -version</pre> -<p>must show the right version number.</p></section><section><a id="Maven_Unpacked"></a> +<div class="verbatim"> +<pre>java -version</pre></div> +<p>must show the right version number.</p></section><section> <h2>Maven Unpacked</h2> -<p>You need to unpack the Maven distribution. Don't unpack it in the middle of your source code; pick some location and unpack it there. Let's assume that the path is <code>${maven.home}</code>.</p></section><section><a id="Maven_in_PATH"></a> +<p>You need to unpack the Maven distribution. Don't unpack it in the middle of your source code; pick some location and unpack it there. Let's assume that the path is <code>${maven.home}</code>.</p></section><section> <h2>Maven in PATH</h2> -<p>You run Maven by invoking a command-line tool: <code>mvn.cmd</code> from the <code>bin</code> directory of the Maven. To do this conveniently, <code>${maven.home}\bin</code> must be in your PATH, just like the Java SDK commands. You can add directories to your <code>PATH</code> in the control panel; the details vary by Windows version.</p></section><section><a id="Firewalls_and_Anti-virus"></a> +<p>You run Maven by invoking a command-line tool: <code>mvn.cmd</code> from the <code>bin</code> directory of the Maven. To do this conveniently, <code>${maven.home}\bin</code> must be in your PATH, just like the Java SDK commands. You can add directories to your <code>PATH</code> in the control panel; the details vary by Windows version.</p></section><section> <h2>Firewalls and Anti-virus</h2> <p>Firewall and Anti-virus sometimes prevent Java from running properly, or Windows Firewall (and various other Firewalls) actively prevent Java.exe from reaching out to the Internet to "download stuff" which is a key part of Maven. You may need to configure the Firewall or Anti-virus to add exceptions to allow such actions.</p></section></section> </main>
Modified: maven/website/content/guides/index.html ============================================================================== --- maven/website/content/guides/index.html (original) +++ maven/website/content/guides/index.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/index.apt.vm at 2024-05-11 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M10 from content/apt/guides/index.apt.vm 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="Eric Redmond" /> <meta name="date" content="2009-08-01" /> - <title>Maven</title> + <title>Maven â Maven Documentation</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/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: 2024-05-11</li> + <li class="active ">Maven Documentation <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/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: 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> @@ -132,12 +129,12 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section><a id="Documentation"></a> -<h1>Documentation</h1><section><a id="Getting_Started_with_Maven"></a> +<section> +<h1>Documentation</h1><section> <h2>Getting Started with Maven</h2> <ul> <li><a href="./getting-started/maven-in-five-minutes.html">Getting Started in 5 Minutes</a></li> -<li><a href="./getting-started/index.html">Getting Started in 30 Minutes</a></li></ul></section><section><a id="Introductions"></a> +<li><a href="./getting-started/index.html">Getting Started in 30 Minutes</a></li></ul></section><section> <h2>Introductions</h2> <ul> <li><a href="./introduction/introduction-to-the-lifecycle.html">The Build Lifecycle</a></li> @@ -147,25 +144,25 @@ <li><a href="./introduction/introduction-to-the-standard-directory-layout.html">Standard Directory Layout</a></li> <li><a href="./introduction/introduction-to-dependency-mechanism.html">The Dependency Mechanism</a> <ul> -<li><a href="./introduction/introduction-to-optional-and-excludes-dependencies.html"> Optional Dependencies and Dependency Exclusions</a></li></ul></li></ul><section><a id="Plugins"></a> +<li><a href="./introduction/introduction-to-optional-and-excludes-dependencies.html"> Optional Dependencies and Dependency Exclusions</a></li></ul></li></ul><section> <h3>Plugins</h3> <ul> <li><a href="./introduction/introduction-to-plugins.html">Plugin Development</a></li> <li><a href="./mini/guide-configuring-plugins.html">Configuring Plug-ins</a></li> <li><a href="./introduction/introduction-to-plugin-prefix-mapping.html">Plugin Prefix Resolution</a></li> -<li><a href="./plugin/guide-java-plugin-development.html">Developing Java Plugins</a></li></ul></section><section><a id="Site"></a> +<li><a href="./plugin/guide-java-plugin-development.html">Developing Java Plugins</a></li></ul></section><section> <h3>Site</h3> <ul> <li><a href="./mini/guide-site.html">Creating a Site</a></li> <li><a href="/doxia/references/apt-format.html">The APT Format</a></li> -<li><a href="./mini/guide-snippet-macro.html">Snippet Macro</a></li></ul></section><section><a id="Archetypes"></a> +<li><a href="./mini/guide-snippet-macro.html">Snippet Macro</a></li></ul></section><section> <h3>Archetypes</h3> <ul> <li><a href="./introduction/introduction-to-archetypes.html">What is an Archetype</a></li> -<li><a href="./mini/guide-creating-archetypes.html">Creating Archetypes</a></li></ul></section><section><a id="Upgrading"></a> +<li><a href="./mini/guide-creating-archetypes.html">Creating Archetypes</a></li></ul></section><section> <h3>Upgrading</h3> <ul> -<li><a href="./mini/guide-relocation.html">Relocation of Artifacts</a></li></ul></section><section><a id="Repositories"></a> +<li><a href="./mini/guide-relocation.html">Relocation of Artifacts</a></li></ul></section><section> <h3><a href="/introduction/introduction-to-repositories.html">Repositories</a></h3> <ul> <li><a href="./mini/guide-3rd-party-jars-local.html">Installing 3rd party JARs to Local Repository</a></li> @@ -178,7 +175,7 @@ <li><a href="./mini/guide-proxies.html">Using Proxies</a></li> <li><a href="./mini/guide-repository-ssl.html">Authenticated HTTPS</a></li> <li><a href="./mini/guide-repository-ssl.html">Remote repository access through authenticated HTTPS</a></li> -<li><a href="./mini/guide-relocation.html">Relocation</a></li></ul></section></section><section><a id="Guides"></a> +<li><a href="./mini/guide-relocation.html">Relocation</a></li></ul></section></section><section> <h2>Guides</h2> <ul> <li><a href="./mini/guide-reproducible-builds.html">Configuring for Reproducible Builds</a></li> @@ -195,40 +192,40 @@ <li><a href="./mini/guide-using-extensions.html">Using Extensions</a></li> <li><a href="./mini/guide-building-for-different-environments.html">Building For Different Environments with Maven 2</a></li> <li><a href="./mini/guide-using-toolchains.html">Using Toolchains</a></li> -<li><a href="/examples/injecting-properties-via-settings.html">Injecting POM Properties via settings.xml</a></li></ul><section><a id="Maven_Tools_and_IDE_Integration"></a> +<li><a href="/examples/injecting-properties-via-settings.html">Injecting POM Properties via settings.xml</a></li></ul><section> <h3>Maven Tools and IDE Integration</h3> <ul> -<li><a href="./mini/guide-bash-m2-completion.html">Maven Auto-Completion Using BASH</a></li></ul></section></section><section><a id="Development_Guides"></a> +<li><a href="./mini/guide-bash-m2-completion.html">Maven Auto-Completion Using BASH</a></li></ul></section></section><section> <h2>Development Guides</h2> <ul> <li><a href="./development/guide-building-maven.html">Building Maven from Scratch</a></li> <li><a href="./development/guide-maven-development.html">Developing Maven</a></li> <li><a href="./development/guide-plugin-documentation.html">The Plugin Documentation Standard</a></li> -<li><a href="./development/guide-documentation-style.html">Maven Documentation Style</a></li></ul></section><section><a id="The_Maven_Community"></a> +<li><a href="./development/guide-documentation-style.html">Maven Documentation Style</a></li></ul></section><section> <h2>The Maven Community</h2> <ul> <li><a href="../community.html">The Maven Community</a></li> <li><a href="./development/guide-helping.html">Helping with Maven</a></li> <li><a href="./mini/guide-new-committers.html">Guide for New Committers</a></li> <li><a href="./development/guide-testing-development-plugins.html">Testing Development Versions of Plugins</a></li> -<li><a href="../articles.html">3rd Party Resources</a></li></ul><section><a id="Conventions"></a> +<li><a href="../articles.html">3rd Party Resources</a></li></ul><section> <h3>Conventions</h3> <ul> <li><a href="../maven-conventions.html">Maven Conventions</a></li> <li><a href="./mini/guide-naming-conventions.html">Naming Conventions</a></li> -<li><a href="./mini/guide-using-one-source-directory.html">When You Can't Use the Conventions</a></li></ul></section><section><a id="The_Central_Repository"></a> +<li><a href="./mini/guide-using-one-source-directory.html">When You Can't Use the Conventions</a></li></ul></section><section> <h3>The Central Repository</h3> <ul> <li><a href="/repository/">Introduction to the Central Repository</a></li> <li><a href="/repository/guide-central-repository-upload.html">Uploading Artifacts to the Central Repository</a></li> -<li><a href="/repository/central-metadata.html">Improving the Repository</a></li></ul></section></section><section><a id="References"></a> +<li><a href="/repository/central-metadata.html">Improving the Repository</a></li></ul></section></section><section> <h2>References</h2> <ul> <li><a href="../pom.html">POM Overview</a> (<a href="../ref/current/maven-model/maven.html">Technical Project Descriptor</a>)</li> <li><a href="../settings.html">Settings Overview</a> (<a href="../ref/current/maven-settings/settings.html">Technical Settings Descriptor</a>)</li> <li><a href="../plugins/index.html">Core Plug-ins List</a></li> <li><a href="../developers/mojo-api-specification.html">Mojo API</a></li> -<li><a href="../glossary.html">Glossary</a></li></ul></section><section><a id="Javadoc_API"></a> +<li><a href="../glossary.html">Glossary</a></li></ul></section><section> <h2>Javadoc API</h2> <p>Here is some useful Javadoc API links to the current version of Maven:</p> <ul> Modified: maven/website/content/guides/introduction/introduction-to-archetypes.html ============================================================================== --- maven/website/content/guides/introduction/introduction-to-archetypes.html (original) +++ maven/website/content/guides/introduction/introduction-to-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/introduction/introduction-to-archetypes.apt at 2024-05-11 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M10 from content/apt/guides/introduction/introduction-to-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" /> <meta name="date" content="2009-08-26" /> - <title>Maven</title> + <title>Maven â Introduction to 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/introduction/introduction-to-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 ">Introduction to Archetypes <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/introduction/introduction-to-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,16 +146,17 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section><a id="Introduction_to_Archetypes"></a> -<h1>Introduction to Archetypes</h1></section><section><a id="What_is_Archetype.3F"></a> +<section> +<h1>Introduction to Archetypes</h1></section><section> <h1>What is Archetype?</h1> <p>In short, Archetype is a Maven project templating toolkit. An archetype is defined as <i>an original pattern or model from which all other things of the same kind are made</i>. The name fits as we are trying to provide a system that provides a consistent means of generating Maven projects. Archetype will help authors create Maven project templates for users, and provides users with the means to generate parameterized versions of those project templates.</p> <p>Using archetypes provides a great way to enable developers work quickly in a way consistent with best practices employed by your project or organization. Within the Maven project, we use archetypes to try and get our users up and running as quickly as possible by providing a sample project that demonstrates many of the features of Maven, while introducing new users to the best practices employed by Maven. In a matter of seconds, a new user can have a working Maven project to use as a jumping board for investigating more of the features in Maven. We have also tried to make the Archetype mechanism additive, and by that we mean allowing portions of a project to be captured in an archetype so that pieces or aspects of a project can be added to existing projects. A good example of this is the Maven site archetype. If, for example, you have used the quick start archetype to generate a working project, you can then quickly create a site for that project by using the site archetype withi n that existing project. You can do anything like this with archetypes.</p> -<p>You may want to standardize J2EE development within your organization, so you may want to provide archetypes for EJBs, or WARs, or for your web services. Once these archetypes are created and deployed in your organization's repository, they are available for use by all developers within your organization.</p><section><a id="Using_an_Archetype"></a> +<p>You may want to standardize J2EE development within your organization, so you may want to provide archetypes for EJBs, or WARs, or for your web services. Once these archetypes are created and deployed in your organization's repository, they are available for use by all developers within your organization.</p><section> <h2>Using an Archetype</h2> <p>To create a new project based on an Archetype, you need to call <code>mvn archetype:generate</code> goal, like the following:</p> -<pre>mvn archetype:generate</pre> -<p>Please refer to <a href="/archetype/maven-archetype-plugin/">Archetype Plugin page</a>.</p></section><section><a id="Provided_Archetypes"></a> +<div class="verbatim"> +<pre>mvn archetype:generate</pre></div> +<p>Please refer to <a href="/archetype/maven-archetype-plugin/">Archetype Plugin page</a>.</p></section><section> <h2>Provided Archetypes</h2> <p>Maven provides several Archetype artifacts:</p> <table class="table table-bordered table-striped"> @@ -198,7 +196,7 @@ <tr class="b"> <td style="text-align: left;">maven-archetype-webapp</td> <td style="text-align: left;">An archetype to generate a sample Maven Webapp project.</td></tr></table> -<p>For more information on these archetypes, please refer to the <a href="/archetypes/index.html">Maven Archetype Bundles page</a>.</p></section><section><a id="What_makes_up_an_Archetype.3F"></a> +<p>For more information on these archetypes, please refer to the <a href="/archetypes/index.html">Maven Archetype Bundles page</a>.</p></section><section> <h2>What makes up an Archetype?</h2> <p>Archetypes are packaged up in a JAR and they consist of the archetype metadata which describes the contents of archetype, and a set of <a class="externalLink" href="http://velocity.apache.org/">Velocity</a> templates which make up the prototype project. If you would like to know how to make your own archetypes, please refer to our <a href="../mini/guide-creating-archetypes.html">Guide to creating archetypes</a>.</p></section></section> </main> Modified: maven/website/content/guides/introduction/introduction-to-dependency-mechanism.html ============================================================================== --- maven/website/content/guides/introduction/introduction-to-dependency-mechanism.html (original) +++ maven/website/content/guides/introduction/introduction-to-dependency-mechanism.html Sun May 12 07:42:36 2024 @@ -2,20 +2,20 @@ <!-- - | Generated by Apache Maven Doxia Site Renderer 2.0.0-M18 from content/apt/guides/introduction/introduction-to-dependency-mechanism.apt at 2024-05-11 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M10 from content/apt/guides/introduction/introduction-to-dependency-mechanism.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="Brett Porter" /> <meta name="author" content="Trygve Laugstol" /> <meta name="author" content="Karl Heinz Marbaise" /> <meta name="date" content="2005-10-12 2016-06-17" /> - <title>Maven</title> + <title>Maven â Introduction to the Dependency Mechanism</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" /> @@ -42,10 +42,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> @@ -53,9 +51,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/introduction/introduction-to-dependency-mechanism.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 ">Introduction to the Dependency Mechanism <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/introduction/introduction-to-dependency-mechanism.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> @@ -160,7 +157,7 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section><a id="Introduction_to_the_Dependency_Mechanism"></a> +<section> <h1>Introduction to the Dependency Mechanism</h1> <p>Dependency management is a core feature of Maven. Managing dependencies for a single project is easy. Managing dependencies for multi-module projects and applications that consist of hundreds of modules is possible. Maven helps a great deal in defining, creating, and maintaining reproducible builds with well-defined classpaths and library versions.</p> <p>Learn more about:</p> @@ -183,13 +180,15 @@ <li><i>Dependency mediation</i> - this determines what version of an artifact will be chosen when multiple versions are encountered as dependencies. Maven picks the "nearest definition". That is, it uses the version of the closest dependency to your project in the tree of dependencies. You can always guarantee a version by declaring it explicitly in your project's POM. Note that if two dependency versions are at the same depth in the dependency tree, the first declaration wins. <ul> <li>"nearest definition" means that the version used will be the closest one to your project in the tree of dependencies. Consider this tree of dependencies: +<div class="verbatim"> <pre> A ├── B │ └── C │ └── D 2.0 └── E - └── D 1.0</pre> + └── D 1.0</pre></div> <p>In text, dependencies for A, B, and C are defined as A -> B -> C -> D 2.0 and A -> E -> D 1.0, then D 1.0 will be used when building A because the path from A to D through E is shorter. You could explicitly add a dependency to D 2.0 in A to force the use of D 2.0, as shown here:</p> +<div class="verbatim"> <pre> A ├── B │ └── C @@ -197,7 +196,7 @@ ├── E │ └── D 1.0 │ - └── D 2.0 </pre></li></ul></li> + └── D 2.0 </pre></div></li></ul></li> <li><i>Dependency management</i> - this allows project authors to directly specify the versions of artifacts to be used when they are encountered in transitive dependencies or in dependencies where no version has been specified. In the example in the preceding section a dependency was directly added to A even though it is not directly used by A. Instead, A can include D as a dependency in its dependencyManagement section and directly control which version of D is used when, or if, it is ever referenced.</li> <li><i>Dependency scope</i> - this allows you to only include dependencies appropriate for the current stage of the build. This is described in more detail below.</li> <li><i>Excluded dependencies</i> - If project X depends on project Y, and project Y depends on project Z, the owner of project X can explicitly exclude project Z as a dependency, using the "exclusion" element.</li> @@ -252,7 +251,7 @@ <h2><a id="Dependency_Management">Dependency Management</a></h2> <p>The dependency management section is a mechanism for centralizing dependency information. When you have a set of projects that inherit from a common parent, it's possible to put all information about the dependency in the common POM and have simpler references to the artifacts in the child POMs. The mechanism is best illustrated through some examples. Given these two POMs which extend the same parent:</p> <p>Project A:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> ... <dependencies> @@ -276,9 +275,9 @@ </dependency> </dependencies> </project> -</code></pre> +</pre></div> <p>Project B:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> ... <dependencies> @@ -298,9 +297,9 @@ </dependency> </dependencies> </project> -</code></pre> +</pre></div> <p>These two example POMs share a common dependency and each has one non-trivial dependency. This information can be put in the parent POM like this:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> ... <dependencyManagement> @@ -337,9 +336,9 @@ </dependencies> </dependencyManagement> </project> -</code></pre> +</pre></div> <p>Then the two child POMs become much simpler:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> ... <dependencies> @@ -356,8 +355,8 @@ </dependency> </dependencies> </project> -</code></pre> -<pre><code> +</pre></div> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> ... <dependencies> @@ -376,11 +375,11 @@ </dependency> </dependencies> </project> -</code></pre> +</pre></div> <p><b>NOTE:</b> In two of these dependency references, we had to specify the <type/> element. This is because the minimal set of information for matching a dependency reference against a dependencyManagement section is actually <b>{groupId, artifactId, type, classifier}</b>. In many cases, these dependencies will refer to jar artifacts with no classifier. This allows us to shorthand the identity set to <b>{groupId, artifactId}</b>, since the default for the type field is <code>jar</code>, and the default classifier is null.</p> <p>A second, and very important use of the dependency management section is to control the versions of artifacts used in transitive dependencies. As an example consider these projects:</p> <p>Project A:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> <modelVersion>4.0.0</modelVersion> <groupId>maven</groupId> @@ -415,9 +414,9 @@ </dependencies> </dependencyManagement> </project> -</code></pre> +</pre></div> <p>Project B:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> <parent> <artifactId>A</artifactId> @@ -455,7 +454,7 @@ </dependency> </dependencies> </project> -</code></pre> +</pre></div> <p>When maven is run on project B, version 1.0 of artifacts a, b, c, and d will be used regardless of the version specified in their POM.</p> <ul> <li>a and c both are declared as dependencies of the project so version 1.0 is used due to dependency mediation. Both also have runtime scope since it is directly specified.</li> @@ -466,7 +465,7 @@ <h3><a id="Importing_Dependencies">Importing Dependencies</a></h3> <p>The examples in the previous section describe how to specify managed dependencies through inheritance. However, in larger projects it may be impossible to accomplish this since a project can only inherit from a single parent. To accommodate this, projects can import managed dependencies from other projects. This is accomplished by declaring a POM artifact as a dependency with a scope of "import".</p> <p>Project B:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> <modelVersion>4.0.0</modelVersion> <groupId>maven</groupId> @@ -506,10 +505,10 @@ </dependency> </dependencies> </project> -</code></pre> +</pre></div> <p>Assuming A is the POM defined in the preceding example, the end result would be the same. All of A's managed dependencies would be incorporated into B except for d since it is defined in this POM.</p> <p>Project X:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> <modelVersion>4.0.0</modelVersion> <groupId>maven</groupId> @@ -534,9 +533,9 @@ </dependencies> </dependencyManagement> </project> -</code></pre> +</pre></div> <p>Project Y:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> <modelVersion>4.0.0</modelVersion> <groupId>maven</groupId> @@ -561,9 +560,9 @@ </dependencies> </dependencyManagement> </project> -</code></pre> +</pre></div> <p>Project Z:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> <modelVersion>4.0.0</modelVersion> <groupId>maven</groupId> @@ -591,13 +590,13 @@ </dependencies> </dependencyManagement> </project> -</code></pre> +</pre></div> <p>In the example above Z imports the managed dependencies from both X and Y. However, both X and Y contain dependency a. Here, version 1.1 of a would be used since X is declared first and a is not declared in Z's dependencyManagement.</p> <p>This process is recursive. For example, if X imports another POM, Q, when Z is processed it will simply appear that all of Q's managed dependencies are defined in X.</p></section><section> <h3><a id="Bill_of_Materials_.28BOM.29_POMs">Bill of Materials (BOM) POMs</a></h3> <p>Imports are most effective when used for defining a "library" of related artifacts that are generally part of a multiproject build. It is fairly common for one project to use one or more artifacts from these libraries. However, it has sometimes been difficult to keep the versions in the project using the artifacts in synch with the versions distributed in the library. The pattern below illustrates how a "bill of materials" (BOM) can be created for use by other projects.</p> <p>The root of the project is the BOM POM. It defines the versions of all the artifacts that will be created in the library. Other projects that wish to use the library should import this POM into the dependencyManagement section of their POM.</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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -629,9 +628,9 @@ <module>parent</module> </modules> </project> -</code></pre> +</pre></div> <p>The parent subproject has the BOM POM as its parent. It is a normal multiproject pom.</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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -665,9 +664,9 @@ <module>project2</module> </modules> </project> -</code></pre> +</pre></div> <p>Next are the actual project POMs.</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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -709,9 +708,9 @@ </dependency> </dependencies> </project> -</code></pre> +</pre></div> <p>The project that follows shows how the library can now be used in another project without having to specify the dependent project's versions.</p> -<pre><code><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> @@ -741,14 +740,14 @@ </dependency> </dependencies> </project> -</code></pre> +</pre></div> <p>Finally, when creating projects that import dependencies, beware of the following:</p> <ul> <li>Do not attempt to import a POM that is defined in a submodule of the current POM. Attempting to do that will result in the build failing since it won't be able to locate the POM.</li> <li>Never declare the POM importing a POM as the parent (or grandparent, etc) of the target POM. There is no way to resolve the circularity and an exception will be thrown.</li> <li>When referring to artifacts whose POMs have transitive dependencies, the project needs to specify versions of those artifacts as managed dependencies. Not doing so results in a build failure since the artifact may not have a version specified. (This should be considered a best practice in any case as it keeps the versions of artifacts from changing from one build to the next).</li></ul> <p>Starting from Maven 4.0, a new specific BOM packaging has been introduced. It allows defining a BOMs which are not used as parent in a project leveraging the newer 4.1.0 model, while still providing full compatibility with Maven 3.X clients and projects. This BOM packaging is translated into a more usual POM packaging at installation / deployment time, leveraging the build/consumer POM feature from Maven 4. This thus provides full compatibility with Maven 3.x.</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project xmlns="http://maven.apache.org/POM/4.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 http://maven.apache.org/xsd/maven-4.1.0.xsd"> <parent> @@ -779,12 +778,12 @@ </dependencies> </dependencyManagement> </project> -</code></pre></section></section><section> +</pre></div></section></section><section> <h2><a id="System_Dependencies">System Dependencies</a></h2> <p><code>Important note: This is deprecated.</code></p> <p>Dependencies with the scope <i>system</i> are always available and are not looked up in repository. They are usually used to tell Maven about dependencies which are provided by the JDK or the VM. Thus, system dependencies are especially useful for resolving dependencies on artifacts which are now provided by the JDK, but were available as separate downloads earlier. Typical examples are the JDBC standard extensions or the Java Authentication and Authorization Service (JAAS).</p> <p>A simple example would be:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> ... <dependencies> @@ -798,9 +797,9 @@ </dependencies> ... </project> -</code></pre> +</pre></div> <p>If your artifact is provided by the JDK's <code>tools.jar</code>, the system path would be defined as follows:</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <dependencies> <dependency> @@ -812,7 +811,7 @@ </dependency> </dependencies> ... -</project></code></pre></section></section> +</project></pre></div></section></section> </main> </div> </div> Modified: maven/website/content/guides/introduction/introduction-to-optional-and-excludes-dependencies.html ============================================================================== --- maven/website/content/guides/introduction/introduction-to-optional-and-excludes-dependencies.html (original) +++ maven/website/content/guides/introduction/introduction-to-optional-and-excludes-dependencies.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/introduction/introduction-to-optional-and-excludes-dependencies.apt at 2024-05-11 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M10 from content/apt/guides/introduction/introduction-to-optional-and-excludes-dependencies.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="Allan Ramirez" /> <meta name="date" content="2006-01-23" /> - <title>Maven</title> + <title>Maven â Optional Dependencies and Dependency Exclusions</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/introduction/introduction-to-optional-and-excludes-dependencies.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 ">Optional Dependencies and Dependency Exclusions <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/introduction/introduction-to-optional-and-excludes-dependencies.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> @@ -157,17 +154,17 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section><a id="Introduction"></a> +<section> <h1>Introduction</h1> -<p>This section discusses optional dependencies and dependency exclusions. This will help users to understand what they are and when and how to use them. It also explains why exclusions are made on a per dependency basis instead of at the POM level.</p><section><a id="Optional_Dependencies"></a> +<p>This section discusses optional dependencies and dependency exclusions. This will help users to understand what they are and when and how to use them. It also explains why exclusions are made on a per dependency basis instead of at the POM level.</p><section> <h2>Optional Dependencies</h2> <p>Optional dependencies are used when it's not possible (for whatever reason) to split a project into sub-modules. The idea is that some of the dependencies are only used for certain features in the project and will not be needed if that feature isn't used. Ideally, such a feature would be split into a sub-module that depends on the core functionality project. This new subproject would have only non-optional dependencies, since you'd need them all if you decided to use the subproject's functionality. </p> -<p>However, since the project cannot be split up (again, for whatever reason), these dependencies are declared optional. If a user wants to use functionality related to an optional dependency, they have to redeclare that optional dependency in their own project. This is not the clearest way to handle this situation, but both optional dependencies and dependency exclusions are stop-gap solutions.</p><section><a id="Why_use_optional_dependencies.3F"></a> +<p>However, since the project cannot be split up (again, for whatever reason), these dependencies are declared optional. If a user wants to use functionality related to an optional dependency, they have to redeclare that optional dependency in their own project. This is not the clearest way to handle this situation, but both optional dependencies and dependency exclusions are stop-gap solutions.</p><section> <h3>Why use optional dependencies?</h3> -<p>Optional dependencies save space and memory. They prevent problematic jars that violate a license agreement or cause classpath issues from being bundled into a WAR, EAR, fat jar, or the like. </p></section><section><a id="How_do_I_use_the_optional_tag.3F"></a> +<p>Optional dependencies save space and memory. They prevent problematic jars that violate a license agreement or cause classpath issues from being bundled into a WAR, EAR, fat jar, or the like. </p></section><section> <h3>How do I use the optional tag?</h3> <p>A dependency is declared optional by setting the <code><optional></code> element to true in its dependency declaration:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> ... <dependencies> @@ -181,23 +178,25 @@ </dependency> </dependencies> </project> -</code></pre></section><section><a id="How_do_optional_dependencies_work.3F"></a> +</pre></div></section><section> <h3>How do optional dependencies work?</h3> +<div class="verbatim"> <pre> Project-A -> Project-B -</pre> +</pre></div> <p>The diagram above says that Project-A depends on Project-B. When A declares B as an optional dependency in its POM, this relationship remains unchanged. It's just like a normal build where Project-B will be added in Project-A's classpath.</p> +<div class="verbatim"> <pre> Project-X -> Project-A -</pre> -<p>When another project (Project-X) declares Project-A as a dependency in its POM, the optional nature of the dependency takes effect. Project-B is not included in the classpath of Project-X. You need to declare it directly in the POM of Project X for B to be included in X's classpath.</p></section><section><a id="Example"></a> +</pre></div> +<p>When another project (Project-X) declares Project-A as a dependency in its POM, the optional nature of the dependency takes effect. Project-B is not included in the classpath of Project-X. You need to declare it directly in the POM of Project X for B to be included in X's classpath.</p></section><section> <h3>Example</h3> -<p>Suppose there is a project named <i>X2</i> that has similar functionality to <i>Hibernate</i>. It supports many databases such as MySQL, PostgreSQL, and several versions of Oracle. Each supported database requires an additional dependency on a driver jar. All of these dependencies are needed at compile time to build X2. However your project only uses one specific database and doesn't need drivers for the others. X2 can declare these dependencies as optional, so that when your project declares X2 as a direct dependency in its POM, all the drivers supported by the X2 are not automatically included in your project's classpath. Your project will have to include an explicit dependency on the specific driver for the one database it does use.</p></section></section><section><a id="Dependency_Exclusions"></a> +<p>Suppose there is a project named <i>X2</i> that has similar functionality to <i>Hibernate</i>. It supports many databases such as MySQL, PostgreSQL, and several versions of Oracle. Each supported database requires an additional dependency on a driver jar. All of these dependencies are needed at compile time to build X2. However your project only uses one specific database and doesn't need drivers for the others. X2 can declare these dependencies as optional, so that when your project declares X2 as a direct dependency in its POM, all the drivers supported by the X2 are not automatically included in your project's classpath. Your project will have to include an explicit dependency on the specific driver for the one database it does use.</p></section></section><section> <h2>Dependency Exclusions</h2> -<p>Since Maven resolves dependencies transitively, it is possible for unwanted dependencies to be included in your project's classpath. For example, a certain older jar may have security issues or be incompatible with the Java version you're using. To address this, Maven allows you to exclude specific dependencies. Exclusions are set on a specific dependency in your POM, and are targeted at a specific groupId and artifactId. When you build your project, that artifact will not be added to your project's classpath <i>by way of the dependency in which the exclusion was declared</i>.</p><section><a id="How_to_use_dependency_exclusions"></a> +<p>Since Maven resolves dependencies transitively, it is possible for unwanted dependencies to be included in your project's classpath. For example, a certain older jar may have security issues or be incompatible with the Java version you're using. To address this, Maven allows you to exclude specific dependencies. Exclusions are set on a specific dependency in your POM, and are targeted at a specific groupId and artifactId. When you build your project, that artifact will not be added to your project's classpath <i>by way of the dependency in which the exclusion was declared</i>.</p><section> <h3>How to use dependency exclusions</h3> <p>Add an <code><exclusions></code> element in the <code><dependency></code> element by which the problematic jar is included.</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> ... <dependencies> @@ -215,8 +214,9 @@ Project-X -> Project-A </dependency> </dependencies> </project> -</code></pre></section><section><a id="How_dependency_exclusion_works_and_when_to_use_it_.28_as_a_last_resort.21_.29"></a> +</pre></div></section><section> <h3>How dependency exclusion works and when to use it <b>( as a last resort! )</b></h3> +<div class="verbatim"> <pre> Project-A -> Project-B @@ -224,18 +224,19 @@ Project-A -> Project-E -> Project-F -> Project C -</pre> +</pre></div> <p>The diagram shows that Project-A depends on both Project-B and C. Project-B depends on Project-D. Project-D depends on both Project-E and F. By default, Project A's classpath will include:</p> -<pre>B, C, D, E, F</pre> +<div class="verbatim"> +<pre>B, C, D, E, F</pre></div> <p>Suppose you don't want project D and its dependencies to be added to Project A's classpath because some of Project-D's dependencies are missing from the repository, and you don't need the functionality in Project-B that depends on Project-D anyway. Project-B's developers could have marked the dependency on Project-D <code><optional>true</optional></code>:</p> -<pre><code><dependency> +<div class="verbatim source"><pre class="prettyprint linenums"><dependency> <groupId>sample.ProjectD</groupId> <artifactId>ProjectD</artifactId> <version>1.0-SNAPSHOT</version> <optional>true</optional> -</dependency></code></pre> +</dependency></pre></div> <p>Unfortunately, they didn't. As a last resort, you can exclude it on your own POM for Project-A like this:</p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> <modelVersion>4.0.0</modelVersion> <groupId>sample.ProjectA</groupId> @@ -257,21 +258,24 @@ Project-A </dependency> </dependencies> </project> -</code></pre> +</pre></div> <p>If you deploy Project-A to a repository, and Project-X declares a normal dependency on Project-A, will Project-D still be excluded from the classpath?</p> +<div class="verbatim"> <pre> Project-X -> Project-A -</pre> +</pre></div> <p>The answer is <b>Yes</b>. Project-A has declared that it doesn't need Project-D to run, so it won't be brought in as a transitive dependency of Project-A. </p> <p>Now, consider that Project-X depends on Project-Y, as in the diagram below:</p> +<div class="verbatim"> <pre> Project-X -> Project-Y -> Project-B -> Project-D ... -</pre> +</pre></div> <p>Project-Y also has a dependency on Project-B, and it does need the features supported by Project-D. Therefore, it will NOT place an exclusion on Project-D in its dependency list. It may also supply an additional repository, from which it can resolve Project-E. In this case, it's important that Project-D <b>is not</b> excluded globally, since it is a legitimate dependency of Project-Y. </p> <p>As another scenario, suppose the dependency you don't want is Project-E instead of Project-D. How do you exclude it? See the diagram below:</p> +<div class="verbatim"> <pre> Project-A -> Project-B @@ -279,9 +283,9 @@ Project-A -> Project-E <!-- Exclude this dependency --> -> Project-F -> Project C -</pre> +</pre></div> <p>Exclusions work on the entire dependency graph below the point where they are declared. If you want to exclude Project-E instead of Project-D, simply change the exclusion to point at Project-E, but you don't move the exclusion down to Project-D. You cannot change Project-D's POM. If you could, you would use optional dependencies instead of exclusions, or split Project-D up into multiple subprojects, each with nothing but normal dependencies. </p> -<pre><code> +<div class="verbatim source"><pre class="prettyprint linenums"> <project> <modelVersion>4.0.0</modelVersion> <groupId>sample.ProjectA</groupId> @@ -303,7 +307,7 @@ Project-A </dependency> </dependencies> </project> -</code></pre></section><section><a id="Why_exclusions_are_made_on_a_per-dependency_basis.2C_rather_than_at_the_POM_level"></a> +</pre></div></section><section> <h3>Why exclusions are made on a per-dependency basis, rather than at the POM level</h3> <p>This is mainly to be sure the dependency graph is predictable, and to keep inheritance effects from excluding a dependency that should not be excluded. If you get to the method of last resort and have to put in an exclusion, you should be absolutely certain which of your dependencies is bringing in that unwanted transitive dependency.</p> <p>If you truly want to ensure that a particular dependency appears nowhere in your classpath, regardless of path, the <a href="/enforcer/enforcer-rules/bannedDependencies.html">banned dependencies rule</a> can be configured to fail the build if a problematic dependency is found. When the build fails, you'll need to add specific exclusions on each path the enforcer finds. </p></section></section></section> Modified: maven/website/content/guides/introduction/introduction-to-plugin-prefix-mapping.html ============================================================================== --- maven/website/content/guides/introduction/introduction-to-plugin-prefix-mapping.html (original) +++ maven/website/content/guides/introduction/introduction-to-plugin-prefix-mapping.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/introduction/introduction-to-plugin-prefix-mapping.apt.vm at 2024-05-11 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M10 from content/apt/guides/introduction/introduction-to-plugin-prefix-mapping.apt.vm 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-08-01" /> - <title>Maven</title> + <title>Maven â Introduction to Plugin Prefix Resolution</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/introduction/introduction-to-plugin-prefix-mapping.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: 2024-05-11</li> + <li class="active ">Introduction to Plugin Prefix Resolution <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/introduction/introduction-to-plugin-prefix-mapping.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: 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,18 +147,18 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section><a id="Introduction_to_Plugin_Prefix_Resolution"></a> +<section> <h1>Introduction to Plugin Prefix Resolution</h1> <p>When you execute Maven using a standard lifecycle phase, resolving the plugins that participate in that lifecycle is a relatively simple process. However, when you directly invoke a mojo from the command line, as in the case of <b>clean</b>, Maven must have some way of reliably resolving the <b>clean</b> plugin prefix to the <b>maven-clean-plugin</b>. This provides brevity for command-line invocations, while preserving the descriptiveness of the plugin's real artifactId.</p> <p>To complicate matters even more, not all plugins should be forced to have the same groupId in the repository. Since groupIds are presumed to be controlled by one project, and multiple projects may release plugins for Maven, it follows that plugin-prefix mappings must also accommodate multiple plugin groupIds.</p> -<p>To address these concerns, Maven provides a new piece of repository-level metadata (not associated with any single artifact) for plugin groups, along with a plugin mapping manager to organize multiple plugin groups and provide search functionality.</p><section><a id="Specifying_a_Plugin.27s_Prefix"></a> +<p>To address these concerns, Maven provides a new piece of repository-level metadata (not associated with any single artifact) for plugin groups, along with a plugin mapping manager to organize multiple plugin groups and provide search functionality.</p><section> <h2>Specifying a Plugin's Prefix</h2> <p>In order to give users a convenient prefix with which to reference your plugin a prefix must be associated with your plugin when it is built. By default, Maven will make a guess at the plugin-prefix to be used, by removing any instances of "maven" or "plugin" surrounded by hyphens in the plugin's artifact ID. The conventional artifact ID formats to use are:</p> <ul> <li><code>maven-${prefix}-plugin</code> - for official plugins maintained by the Apache Maven team itself (you <b>must not</b> use this naming pattern for your plugin, see <a href="../plugin/guide-java-plugin-development.html#Plugin_Naming_Convention_and_Apache_Maven_Trademark">this note for more informations</a>)</li> <li><code>${prefix}-maven-plugin</code> - for plugins from other sources</li></ul> <p>If your plugin's artifactId fits this pattern, Maven will automatically map your plugin to the correct prefix in the metadata stored within your plugin's groupId path on the repository. However, if you want to customize the prefix used to reference your plugin, you can specify the prefix directly through a configuration parameter on the <code>maven-plugin-plugin</code> in your plugin's POM:</p> -<pre><code><project> +<div class="verbatim source"><pre class="prettyprint linenums"><project> ... <build> ... @@ -177,30 +174,32 @@ </plugin> </plugins> </build> -</project></code></pre> +</project></pre></div> <p>The above configuration will allow users to refer to your plugin by the prefix <b>somePrefix</b>, as in the following example:</p> -<pre>mvn somePrefix:goal</pre></section><section><a id="Mapping_Prefixes_to_Plugins"></a> +<div class="verbatim"> +<pre>mvn somePrefix:goal</pre></div></section><section> <h2>Mapping Prefixes to Plugins</h2> <p>For each groupId configured for searching, Maven will:</p> -<ol style="list-style-type: decimal;"> +<ol style="list-style-type: decimal"> <li>Download <code>maven-metadata.xml</code> from each remote repository into the local repository, and name it <code>maven-metadata-${repoId}.xml</code> within the path of ${groupId}.</li> <li>Load these metadata files, along with <code>maven-metadata-local.xml</code> (if it exists), within the path of ${groupId}. Merge them.</li> <li>Lookup the plugin prefix in the merged metadata. If it's mapped, it should refer to a concrete groupId-artifactId pair. Otherwise, go on to #1 for the next groupId in the user's plugin-groups.</li></ol> -<p>These metadata files consist of the <b>groupId</b> it represents (for clarity when the file is opened outside the context of the directory), and a group of <b>plugin</b> elements. Each <b>plugin</b> in this list contains a <b>prefix</b> element denoting the plugin's command-line prefix, and an <b>artifactId</b> element, which provides the other side of the prefix mapping and provides enough information to lookup and use the plugin. When a plugin is installed or deployed, the appropriate metadata file is located - and if the prefix mapping is missing - modified to include the plugin-prefix mapping.</p></section><section><a id="Configuring_Maven_to_Search_for_Plugins"></a> +<p>These metadata files consist of the <b>groupId</b> it represents (for clarity when the file is opened outside the context of the directory), and a group of <b>plugin</b> elements. Each <b>plugin</b> in this list contains a <b>prefix</b> element denoting the plugin's command-line prefix, and an <b>artifactId</b> element, which provides the other side of the prefix mapping and provides enough information to lookup and use the plugin. When a plugin is installed or deployed, the appropriate metadata file is located - and if the prefix mapping is missing - modified to include the plugin-prefix mapping.</p></section><section> <h2>Configuring Maven to Search for Plugins</h2> <p>By default, Maven will search the groupId <b>org.apache.maven.plugins</b> for prefix-to-artifactId mappings for the plugins it needs to perform a given build. However, as previously mentioned, the user may have a need for third-party plugins. Since the Maven project is assumed to have control over the default plugin groupId, this means configuring Maven to search other groupId locations for plugin-prefix mappings.</p> <p>As it turns out, this is simple. In the Maven settings file (per-user: <code>${user.home}/.m2/settings.xml</code>; global: <code>${maven.home}/conf/settings.xml</code>), you can provide a custom <b>pluginGroups</b> section, listing the plugin groupIds you want to search (each groupId goes in its own <b>pluginGroup</b> sub-element). For example, if my project uses a Modello model file, I might have the following in my settings:</p> -<pre><code><pluginGroups> +<div class="verbatim source"><pre class="prettyprint linenums"><pluginGroups> <pluginGroup>org.codehaus.modello</pluginGroup> -</pluginGroups></code></pre> +</pluginGroups></pre></div> <p>This allows me to execute the following, which will generate Java classes from the model:</p> -<pre>mvn -Dversion=4.0.0 -Dmodel=maven.mdo modello:java</pre> +<div class="verbatim"> +<pre>mvn -Dversion=4.0.0 -Dmodel=maven.mdo modello:java</pre></div> <p>Maven will always search the following groupId's <b>after</b> searching any plugin groups specified in the user's settings:</p> <ul> <li>org.apache.maven.plugins</li> <li>org.codehaus.mojo</li></ul> <p><b>NOTE:</b> When specifying plugin groups to be used in searching for a prefix mapping, order is critical! By specifying a pluginGroup of <code>com.myco.plugins</code> with a prefix of <code>clean</code>, I can override the usage of the <code>maven-clean-plugin</code> when <code>clean:clean</code> is invoked.</p> -<p><b>NOTE2:</b> For more information on <code>settings.xml</code>, see [<a href="#a1">1</a>].</p></section><section><a id="Resources"></a> +<p><b>NOTE2:</b> For more information on <code>settings.xml</code>, see [<a href="#a1">1</a>].</p></section><section> <h2>Resources</h2> <p><a id="a1">1</a> <a href="../mini/guide-configuring-maven.html">Guide to Configuring Maven</a></p></section></section> </main> Modified: maven/website/content/guides/introduction/introduction-to-plugins.html ============================================================================== --- maven/website/content/guides/introduction/introduction-to-plugins.html (original) +++ maven/website/content/guides/introduction/introduction-to-plugins.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/introduction/introduction-to-plugins.apt at 2024-05-11 + | Generated by Apache Maven Doxia Site Renderer 2.0.0-M10 from content/apt/guides/introduction/introduction-to-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="John Casey" /> <meta name="date" content="2005-06-24" /> - <title>Maven</title> + <title>Maven â Introduction to Maven Plugin Development</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/introduction/introduction-to-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 ">Introduction to Maven Plugin Development <a href="https://github.com/apache/maven-site/tree/master/content/apt/guides/introduction/introduction-to-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> @@ -143,20 +140,20 @@ </div> </header> <main id="bodyColumn" class="span10" > -<section><a id="Introduction_to_Maven_Plugin_Development"></a> +<section> <h1>Introduction to Maven Plugin Development</h1> -<p>Maven consists of a core engine which provides basic project-processing capabilities and build-process management, and a host of plugins which are used to execute the actual build tasks.</p><section><a id="What_is_a_Plugin.3F"></a> +<p>Maven consists of a core engine which provides basic project-processing capabilities and build-process management, and a host of plugins which are used to execute the actual build tasks.</p><section> <h2>What is a Plugin?</h2> <p>"Maven" is really just a core framework for a collection of Maven Plugins. In other words, plugins are where much of the real action is performed, plugins are used to: create jar files, create war files, compile code, unit test code, create project documentation, and on and on. Almost any action that you can think of performing on a project is implemented as a Maven plugin.</p> <p>Plugins are the central feature of Maven that allow for the reuse of common build logic across multiple projects. They do this by executing an "action" (i.e. creating a WAR file or compiling unit tests) in the context of a project's description - the Project Object Model (POM). Plugin behavior can be customized through a set of unique parameters which are exposed by a description of each plugin goal (or Mojo).</p> -<p>One of the simplest plugins in Maven is the Clean Plugin. The <a href="../../plugins/maven-clean-plugin/">Maven Clean plugin</a> (maven-clean-plugin) is responsible for removing the target directory of a Maven project. When you run "mvn clean", Maven executes the "clean" goal as defined in the Clean plug-in, and the target directory is removed. The Clean plugin <a href="../../plugins/maven-clean-plugin/clean-mojo.html">defines a parameter</a> which can be used to customize plugin behavior, this parameter is called outputDirectory and it defaults to ${project.build.directory}.</p></section><section><a id="What_is_a_Mojo_.28And_Why_the_H---_is_it_Named_.27Mojo.27.29.3F"></a> +<p>One of the simplest plugins in Maven is the Clean Plugin. The <a href="../../plugins/maven-clean-plugin/">Maven Clean plugin</a> (maven-clean-plugin) is responsible for removing the target directory of a Maven project. When you run "mvn clean", Maven executes the "clean" goal as defined in the Clean plug-in, and the target directory is removed. The Clean plugin <a href="../../plugins/maven-clean-plugin/clean-mojo.html">defines a parameter</a> which can be used to customize plugin behavior, this parameter is called outputDirectory and it defaults to ${project.build.directory}.</p></section><section> <h2>What is a Mojo (<i>And Why the H--- is it Named 'Mojo'</i>)?</h2> <p>A Mojo is really just a <b>goal</b> in Maven, and plug-ins consist of any number of goals (Mojos). Mojos can be defined as annotated Java classes or Beanshell script. A Mojo specifies metadata about a goal: a goal name, which phase of the lifecycle it fits into, and the parameters it is expecting.</p> -<p>MOJO is a play on POJO (Plain-old-Java-object), substituting "Maven" for "Plain". Mojo is also an interesting word (see <a class="externalLink" href="http://www.answers.com/mojo&r=67">definition</a>). From <a class="externalLink" href="http://www.wikipedia.org">Wikipedia</a>, a "mojo" is defined as: "...a small bag worn by a person under the clothes (also known as a mojo hand). Such bags were thought to have supernatural powers, such as protecting from evil, bringing good luck, etc."</p></section><section><a id="What_is_the_Build_Lifecycle.3F_.28Overview.29"></a> +<p>MOJO is a play on POJO (Plain-old-Java-object), substituting "Maven" for "Plain". Mojo is also an interesting word (see <a class="externalLink" href="http://www.answers.com/mojo&r=67">definition</a>). From <a class="externalLink" href="http://www.wikipedia.org">Wikipedia</a>, a "mojo" is defined as: "...a small bag worn by a person under the clothes (also known as a mojo hand). Such bags were thought to have supernatural powers, such as protecting from evil, bringing good luck, etc."</p></section><section> <h2>What is the Build Lifecycle? (Overview)</h2> -<p>The build lifecycle is a series of common <b>stage</b>s through which all project builds naturally progress. Plugin goals are bound to specific stages in the lifecycle.</p></section></section><section><a id="Resources"></a> +<p>The build lifecycle is a series of common <b>stage</b>s through which all project builds naturally progress. Plugin goals are bound to specific stages in the lifecycle.</p></section></section><section> <h1>Resources</h1> -<ol style="list-style-type: decimal;"> +<ol style="list-style-type: decimal"> <li><a href="/plugin-developers/index.html">Plugin Development Center</a></li> <li><a href="../mini/guide-configuring-plugins.html">Configuring plugins</a></li></ol></section> </main>