You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2020/10/18 16:07:41 UTC
[maven-site] branch master updated: add titles for default vs
advanced configuration inheritance
This is an automated email from the ASF dual-hosted git repository.
hboutemy 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 ce2300a add titles for default vs advanced configuration inheritance
ce2300a is described below
commit ce2300adfc75b5aa56356ba77170f18f9a65ca0e
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sun Oct 18 18:07:36 2020 +0200
add titles for default vs advanced configuration inheritance
---
content/apt/pom.apt | 135 +++++++++++++++++++++++++++-------------------------
1 file changed, 69 insertions(+), 66 deletions(-)
diff --git a/content/apt/pom.apt b/content/apt/pom.apt
index 2e2a10b..c408971 100644
--- a/content/apt/pom.apt
+++ b/content/apt/pom.apt
@@ -70,6 +70,10 @@ POM Reference
[[2]] {{{Plugins}Plugins}}
+ [[1]]{{{default_configuration_inheritance}Default Configuration Inheritance}}
+
+ [[2]]{{{advanced_configuration_inheritance}Advanced Configuration Inheritance}}
+
[[3]] {{{Plugin_Management}Plugin Management}}
[[2]] {{{Build_Element}The Build Element Set}}
@@ -1045,72 +1049,77 @@ Display parameters as parsed by Maven (in canonical form) and comparison result:
If your POM declares a parent, it inherits plugin configuration from either the
<<build/plugins>> or <<pluginManagement>> sections of the parent.
- To illustrate, consider the following fragment from a parent POM:
+ * {<<default configuration inheritance>>}:
+
+ To illustrate, consider the following fragment from a parent POM:
+-----------------------------------------------+
<plugin>
-<groupId>my.group</groupId>
-<artifactId>my-plugin</artifactId>
-<configuration>
- <items>
- <item>parent-1</item>
- <item>parent-2</item>
- </items>
- <properties>
- <parentKey>parent</parentKey>
- </properties>
-</configuration>
+ <groupId>my.group</groupId>
+ <artifactId>my-plugin</artifactId>
+ <configuration>
+ <items>
+ <item>parent-1</item>
+ <item>parent-2</item>
+ </items>
+ <properties>
+ <parentKey>parent</parentKey>
+ </properties>
+ </configuration>
</plugin>
+-----------------------------------------------+
- And consider the following plugin configuration from a project that uses that parent
- as its parent:
+ And consider the following plugin configuration from a project that uses that parent as its parent:
+-----------------------------------------------+
<plugin>
-<groupId>my.group</groupId>
-<artifactId>my-plugin</artifactId>
-<configuration>
- <items>
- <item>child-1</item>
- </items>
- <properties>
- <childKey>child</childKey>
- </properties>
-</configuration>
+ <groupId>my.group</groupId>
+ <artifactId>my-plugin</artifactId>
+ <configuration>
+ <items>
+ <item>child-1</item>
+ </items>
+ <properties>
+ <childKey>child</childKey>
+ </properties>
+ </configuration>
+</plugin>
+-----------------------------------------------+
- The default behavior is to merge the content of the <<configuration>>
- element according to element name. If the child POM has a particular
- element, that value becomes the effective value. if the child POM
- does not have an element, but the parent does, the parent value
- becomes the effective value. Note that this is purely an operation on XML;
- no code or configuration of the plugin itself is involved. Only the
- elements, not their values, are involved.
+ The default behavior is to merge the content of the <<configuration>>
+ element according to element name. If the child POM has a particular
+ element, that value becomes the effective value. if the child POM
+ does not have an element, but the parent does, the parent value
+ becomes the effective value. Note that this is purely an operation on XML;
+ no code or configuration of the plugin itself is involved. Only the
+ elements, not their values, are involved.
- Applying those rules to the example, Maven comes up with:
+ Applying those rules to the example, Maven comes up with:
+-----------------------------------------------+
<plugin>
-<groupId>my.group</groupId>
-<artifactId>my-plugin</artifactId>
-<configuration>
- <items>
- <item>child-1</item>
- </items>
- <properties>
- <childKey>child</childKey>
- <parentKey>parent</parentKey>
- </properties>
-</configuration>
+ <groupId>my.group</groupId>
+ <artifactId>my-plugin</artifactId>
+ <configuration>
+ <items>
+ <item>child-1</item>
+ </items>
+ <properties>
+ <childKey>child</childKey>
+ <parentKey>parent</parentKey>
+ </properties>
+ </configuration>
+</plugin>
+-----------------------------------------------+
- You can control how child POMs inherit configuration from parent POMs by adding attributes
- to the children of the <<configuration>> element. The attributes are <<<combine.children>>> and
- <<<combine.self>>>. Use these attributes in a child POM to control how Maven combines
- plugin configuration from the parent with the explicit configuration in the child.
+ * {<<advanced configuration inheritance>>}: <<<combine.children>>> and <<<combine.self>>>
- Here is the child configuration with illustrations of the two attributes:
+ You can control how child POMs inherit configuration from parent POMs by adding attributes
+ to the children of the <<configuration>> element. The attributes are <<<combine.children>>> and
+ <<<combine.self>>>. Use these attributes in a child POM to control how Maven combines
+ plugin configuration from the parent with the explicit configuration in the child.
+
+ Here is the child configuration with illustrations of the two attributes:
+-----------------------------------------------+
<configuration>
@@ -1125,7 +1134,7 @@ Display parameters as parsed by Maven (in canonical form) and comparison result:
</configuration>
+-----------------------------------------------+
- Now, the effective result is the following:
+ Now, the effective result is the following:
+-----------------------------------------------+
<configuration>
@@ -1140,23 +1149,17 @@ Display parameters as parsed by Maven (in canonical form) and comparison result:
</configuration>
+-----------------------------------------------+
- <<combine.children="append">> results in the
- concatenation of parent and child elements, in that order.
- <<combine.self="override">>, on the other hand, completely
- suppresses parent configuration. You cannot use both
- <<combine.self="override">>
- and <<combine.children="append">> on an element; if you try,
- <override> will prevail.
-
- Note that these attributes only apply to the configuration element
- they are declared on, and are not propagated to nested elements. That
- is if the content of an <item> element from the child POM was a complex
- structure instead of text, its sub-elements would still be
- subject to the default merge strategy unless they were themselves
- marked with attributes.
-
- The <<<combine.*>>> attributes are inherited from parent to child POMs.
- Take care when adding those attributes to a parent POM as this might affect child or grand-child POMs.
+ <<combine.children="append">> results in the concatenation of parent and child elements, in that order.
+ <<combine.self="override">>, on the other hand, completely suppresses parent configuration. You cannot use both
+ <<combine.self="override">> and <<combine.children="append">> on an element; if you try,
+ <override> will prevail.
+
+ Note that these attributes only apply to the configuration element they are declared on, and are not propagated to nested elements. That
+ is if the content of an <item> element from the child POM was a complex structure instead of text, its sub-elements would still be
+ subject to the default merge strategy unless they were themselves marked with attributes.
+
+ The <<<combine.*>>> attributes are inherited from parent to child POMs.
+ Take care when adding those attributes to a parent POM as this might affect child or grand-child POMs.
* <<dependencies>>:
Dependencies are seen a lot within the POM, and are an element under all plugins element blocks.