This is an automated email from the ASF dual-hosted git repository.

mbuenger 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 5633dbd4 Add some missing infos to the "What's new in Maven 4" page 
(#1429)
5633dbd4 is described below

commit 5633dbd485571aa22318101ff53ef22d41ee0191
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Oct 17 22:42:38 2025 +0200

    Add some missing infos to the "What's new in Maven 4" page (#1429)
---
 content/markdown/whatsnewinmaven4.md | 83 +++++++++++++++++++++++++++++++++---
 1 file changed, 77 insertions(+), 6 deletions(-)

diff --git a/content/markdown/whatsnewinmaven4.md 
b/content/markdown/whatsnewinmaven4.md
index 96f38fc7..bf72e9fd 100644
--- a/content/markdown/whatsnewinmaven4.md
+++ b/content/markdown/whatsnewinmaven4.md
@@ -71,6 +71,16 @@ Maven 4 generates a stripped down consumer POM that removes 
build information no
 to the remote repository.
 It does not deploy the `pom.xml` used to build the project.
 
+The consumer POM is a **flattened** version of the build POM, meaning:
+
+* It contains no parent POM references (all inherited elements are resolved 
and included directly)
+* BOM imports are flattened into the dependency list
+* Only transitive dependencies are kept (compile and runtime scopes)
+* Managed dependencies are kept only if they are actually used by the project
+
+This flattening ensures that consumers of your artifact have all the 
information they need without requiring access to
+parent POMs or understanding the internal structure of your multi-project 
build.
+
 ### Model version 4.1.0
 
 Maven 4 updates the POM version to 4.1.0 which defines the namespace 
`http://maven.apache.org/POM/4.1.0`.
@@ -204,7 +214,7 @@ One of the first projects that uses this feature is the 
[Apache Maven Hocon Exte
 
 ## Improvements for subprojects
 
-### Automatic versioning
+### Automatic versioning (POM inference)
 
 Maven 4 finally ships one of the oldest improvement requests - automatic 
parent versioning ([MNG-624][17], created in
 July 2005 and originally planned for Maven 2)!
@@ -213,6 +223,35 @@ As expected, it's no longer required to define the parent 
versions in each subpr
 This also extends to dependencies of project's own subprojects and reduces the 
need to update POM files for new
 versions even more.
 
+#### Parent inference
+
+When using model version 4.1.0, you can omit the version, groupId, and 
artifactId from the `<parent>` element by using
+a relative path. Maven will automatically infer these values by looking for a 
`pom.xml` file in the specified directory.
+
+You can use either of these forms:
+
+* `<parent><relativePath>..</relativePath></parent>` - explicitly specify the 
relative path to the parent directory
+* `<parent/>` - shorthand form that defaults to looking in the parent 
directory (`..`)
+
+This makes it easier to maintain multi-project builds without duplicating 
version and coordinate information.
+
+#### Subprojects discovery
+
+Maven 4 can automatically discover subprojects in subdirectories without 
requiring them to be explicitly listed in the
+`<subprojects>` (or deprecated `<modules>`) section. This reduces boilerplate 
in your POM files and makes it easier to
+add new subprojects to your build.
+
+Subprojects are automatically discovered when:
+
+* The parent POM has `pom` packaging
+* No `<subprojects>` or `<modules>` section is explicitly defined
+* Direct subdirectories contain a `pom.xml` file
+
+When these conditions are met, Maven will automatically add all subdirectories 
with a `pom.xml` file to the list of
+subprojects to build.
+
+#### Example
+
 The following code snippet shows the parent and dependency definition without 
the version tag.
 
 ```xml
@@ -242,7 +281,7 @@ The following code snippet shows the parent and dependency 
definition without th
 Maven 3.5.0 introduced partial support for CI-friendly variables, like 
`${revision}`, in your POM files.
 However, this still required the usage of the [Flatten Maven Plugin][20] for 
full functionality.
 Since Maven 4, no additional plugin is needed; full built-in support is 
provided.
-You can now use variables as versions in your configuration.
+You can now use **any variable** as versions in your configuration, not just 
predefined ones.
 
 Example
 
@@ -253,8 +292,14 @@ Example
 <version>${revision}</version>
 ```
 
-You have to provide a value for this variable when starting the build, for 
example by using a `maven.config` file.
-In CI pipelines it's commonly done using a parameter, for example `mvn verify 
-Drevision=4.0.1`.
+Variables must be defined at build time using one of the following methods:
+
+* Maven properties defined on the command line, for example `mvn verify 
-Drevision=4.0.1`
+* Maven properties defined in a `maven.config` file in the `.mvn` directory
+* Maven properties defined in the root POM or parent POM
+
+This flexibility allows you to use any variable name you prefer, making it 
easier to integrate Maven with your CI/CD
+pipelines and build automation systems.
 
 Maven maintainer Karl Heinz Marbaise shows a larger example in
 his [article "Maven 4 - Part I - Easier Versions" (2024)][21].
@@ -347,8 +392,19 @@ See the following snippet for an example:
 [INFO] The requested optional profiles [nonexistent] could not be activated or 
deactivated because they do not exist.
 ```
 
-Maven 4 also introduces more flexible ways to activate profiles by providing 
condition-based activation.
-See [MNG-8286][27] for more information about supported functions.
+#### Condition-based profile activation
+
+Maven 4 introduces more flexible ways to activate profiles by providing 
condition-based activation through the new
+`<condition>` element in the `<activation>` section. This allows you to use 
expressions to determine when a profile
+should be activated, providing much more control than the traditional 
property-based or OS-based activation.
+
+For example, you can now activate profiles based on complex conditions like:
+
+* Checking if a file exists or doesn't exist
+* Comparing property values
+* Combining multiple conditions with logical operators
+
+See [MNG-8286][27] for more information about supported functions and the 
complete syntax for condition-based activation.
 
 ### Lifecycle changes
 
@@ -486,6 +542,21 @@ resident Maven processes.
 With Maven 4, you can also take advantage of the newly defined "[Maven 
Shell](./tools/mvnsh.html)" (`mvnsh`), which keeps a single Maven
 process running for as long as the shell remains open.
 
+### Maven Upgrade Tool
+
+If you're currently using Maven 3 and want to upgrade to Maven 4, you can use 
the [Maven Upgrade Tool](https://maven.apache.org/tools/mvnup.html).
+This tool helps automate the migration process by analyzing your project and 
making necessary adjustments to ensure
+compatibility with Maven 4.
+
+The Maven Upgrade Tool tool can be used to:
+
+* Automatically update your POM files to use the new model version 4.1.0 (if 
desired)
+* Identify deprecated features and suggest replacements
+* Help migrate from deprecated plugin configurations to their modern 
equivalents
+* Validate that your project is ready for Maven 4
+
+Refer to [Maven Upgrade Tool](https://maven.apache.org/tools/mvnup.html) for 
more information on usage and the upgrade process in general.
+
 ## Issue overview
 
 The Maven issue tracker provides a [full list of all resolved issues of Maven 
4.0.0][22].

Reply via email to