This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-site.git
The following commit(s) were added to refs/heads/master by this push:
new e8636948 Correct the Maven 4 command for running one subproject and
describe the parent lookup
e8636948 is described below
commit e8636948ecb9791473df4d7290a28a501425daa1
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Mon Nov 2 13:15:10 2026 +0000
Correct the Maven 4 command for running one subproject and describe the
parent lookup
---
content/markdown/guides/mini/guide-multiple-subprojects-4.md | 7 ++++++-
content/markdown/pom.md | 2 ++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/content/markdown/guides/mini/guide-multiple-subprojects-4.md
b/content/markdown/guides/mini/guide-multiple-subprojects-4.md
index fecee7cd..a624064a 100644
--- a/content/markdown/guides/mini/guide-multiple-subprojects-4.md
+++ b/content/markdown/guides/mini/guide-multiple-subprojects-4.md
@@ -178,7 +178,12 @@ as depicted above.
| Also make dependencies outside of current scope | parent,
subproject-a, subproject-b, subproject-c, subproject-c-2 | N/A
| `cd subproject-c/subproject-c-2 &&
mvn compile -am` |
| Also make dependents outside of current scope |
subproject-a, subproject-b, subproject-c-2 | N/A
| `cd subproject-a && mvn
compile -amd` |
| Resuming from a subproject and build all dependencies | parent,
subproject-a, subproject-b, subproject-c, subproject-c-2 | N/A
| `mvn compile -rf :subproject-c-2
-am` or `mvn compile -r -am` |
-| Run specific goal on one subproject with dependencies from project |
subproject-c-2 | `mvn install
&& mvn jetty:run -f subproject-c/subproject-c-2` | `mvn compile && mvn
jetty:run -f subproject-c/subproject-c-2` |
+| Run specific goal on one subproject with dependencies from project |
subproject-c-2 | `mvn install
&& mvn jetty:run -f subproject-c/subproject-c-2` | `mvn package && mvn
jetty:run -f subproject-c/subproject-c-2` |
+
+In the last row, Maven 4 finds the other subprojects in the project-local
repository, `.mvn/target/project-local-repo`
+in the root directory, which Maven creates itself. `mvn package` and later
phases put each subproject's artifacts
+there, and `mvn clean` removes them, so after only `mvn compile` the build
with `-f` cannot resolve the subprojects it
+depends on.
## More information
diff --git a/content/markdown/pom.md b/content/markdown/pom.md
index 09a119d4..57054305 100644
--- a/content/markdown/pom.md
+++ b/content/markdown/pom.md
@@ -572,6 +572,8 @@ Notable elements which are **not** inherited include:
Notice the `<relativePath>` element.
It is not required, but may be used as a signifier to Maven to first search
the path given for this project's parent, before searching the local and then
remote repositories.
+Without it, Maven looks in `../pom.xml`, and uses the POM it finds there only
if its coordinates match the `<parent>` element.
+With an empty `<relativePath/>`, Maven 3 skips the file system and searches
the repositories; Maven 4 also finds the parent among the projects of the build.
To see inheritance in action, just have a look at the
[ASF](https://github.com/apache/maven-apache-parent/blob/master/pom.xml) or
[Maven](https://github.com/apache/maven-parent/blob/master/pom.xml) parent
POM's.