You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-commits@maven.apache.org by sv...@apache.org on 2025/02/07 11:58:01 UTC
svn commit: r1923643 - /maven/website/content/pom.html
Author: svn-site-role
Date: Fri Feb 7 11:58:00 2025
New Revision: 1923643
Log:
Site checkin for project Apache Maven Site
Modified:
maven/website/content/pom.html
Modified: maven/website/content/pom.html
==============================================================================
--- maven/website/content/pom.html (original)
+++ maven/website/content/pom.html Fri Feb 7 11:58:00 2025
@@ -291,7 +291,7 @@
<p>Dependency management has a long tradition of being a complicated mess for anything but the most trivial of projects. <i>"Jarmageddon"</i> quickly ensues as the dependency tree becomes large and complicated. <i>"Jar Hell"</i> follows, where versions of dependencies on one system are not equivalent to the versions developed with, either by the wrong version given, or conflicting versions between similarly named jars.</p>
<p>Maven solves both problems through a common local repository from which to link projects correctly, versions and all.</p><section><a id="Dependencies"></a>
<h4>Dependencies</h4>
-<p>The cornerstone of the POM is its <a href="/ref/current/maven-model/maven.html#class_dependency">dependency</a> list. Most projects depend on others to build and run correctly. If all Maven does for you is manage this list, you have gained a lot. Maven downloads and links the dependencies on compilation, as well as on other goals that require them. As an added bonus, Maven brings in the dependencies of those dependencies (transitive dependencies), allowing your list to focus solely on the dependencies your project requires.</p>
+<p>The cornerstone of the POM is its <a href="/ref/current/maven-model/maven.html#class_dependency">dependency</a> list. Most projects depend on others to build and run correctly. Maven downloads the dependencies on compilation, as well as on other goals that require them. As an added bonus, Maven brings in the dependencies of those dependencies (transitive dependencies), allowing your list to focus solely on the dependencies your project requires.</p>
<pre class="prettyprint linenums"><code><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">
...
@@ -333,7 +333,7 @@
<li><b>test</b> - this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases. It is not transitive.</li>
<li><b>system</b> - this scope is similar to <code>provided</code> except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository.</li></ul></li>
<li><b>systemPath</b>:<br />is used <i>only</i> if the dependency <code>scope</code> is <code>system</code>. Otherwise, the build will fail if this element is set. The path must be absolute, so it is recommended to use a property to specify the machine-specific path (more on <code>properties</code> below), such as <code>${java.home}/lib</code>. Since it is assumed that system scope dependencies are installed <i>a priori</i>, Maven does not check the repositories for the project, but instead checks to ensure that the file exists. If not, Maven fails the build and suggests that you download and install it manually.</li>
-<li><b>optional</b>:<br />Marks a dependency optional when this project itself is a dependency. For example, imagine a project <code>A</code> that depends upon project <code>B</code> to compile a portion of code that may not be used at runtime, then we may have no need for project <code>B</code> for all project. So if project <code>X</code> adds project <code>A</code> as its own dependency, then Maven does not need to install project <code>B</code> at all. Symbolically, if <code>=></code> represents a required dependency, and <code>--></code> represents optional, although <code>A=>B</code> may be the case when building A <code>X=>A-->B</code> would be the case when building <code>X</code>.
+<li><b>optional</b>:<br />Marks a dependency optional when this project itself is a dependency. For example, imagine a project <code>A</code> that depends upon project <code>B</code> to compile a portion of code that may not be used at runtime. In that case, if project <code>X</code> adds project <code>A</code> as its own dependency, project <code>X</code> does not need project <code>B</code> on the classpath and Maven does not need to install project <code>B</code> at all. Symbolically, if <code>=></code> represents a required dependency, and <code>--></code> represents optional, although <code>A=>B</code> may be the case when building A <code>X=>A-->B</code> would be the case when building <code>X</code>.
<p>In the shortest terms, <code>optional</code> lets other projects know that, when you use this project, you do not require this dependency in order to work correctly.</p></li></ul><section><a id="Dependency_Management"></a>
<h5>Dependency Management</h5>
<p>Dependencies can be managed in the <code>dependencyManagement</code> section to affect the resolution of dependencies which are not fully qualified or to enforce the usage of a specific transitive dependency version. Further information in <a href="./guides/introduction/introduction-to-dependency-mechanism.html">Introduction to the Dependency Mechanism</a>.</p></section><section><a id="Dependency_Version_Requirement_Specification"></a>