-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,8 +95,6 @@ public void writeToSerializer( String namespace, XmlSerializer serializer, Xpp3D | |
* </ol></li> | ||
* <li> If mergeSelf == true | ||
* <ol type="A"> | ||
* <li> if the dominant root node's value is empty, set it to the recessive root node's value</li> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
kwin
Author
Contributor
|
||
* <li> For each attribute in the recessive root node which is not set in the dominant root node, set it.</li> | ||
* <li> Determine whether children from the recessive DOM will be merged or appended to the dominant DOM as | ||
* siblings (flag=mergeChildren). | ||
* <ol type="i"> | ||
|
@@ -140,12 +138,6 @@ private static void mergeIntoXpp3Dom( Xpp3Dom dominant, Xpp3Dom recessive, Boole | |
|
||
if ( mergeSelf ) | ||
{ | ||
if ( isEmpty( dominant.getValue() ) && !isEmpty( recessive.getValue() ) ) | ||
{ | ||
dominant.setValue( recessive.getValue() ); | ||
dominant.setInputLocation( recessive.getInputLocation() ); | ||
} | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
gnodet
Member
|
||
String[] recessiveAttrs = recessive.getAttributeNames(); | ||
for ( String attr : recessiveAttrs ) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,7 +115,7 @@ public void testCombineKeys() | |
} | ||
|
||
@Test | ||
public void testOverwriteDominantBlankValue() throws XmlPullParserException, IOException { | ||
public void testPreserveDominantBlankValue() throws XmlPullParserException, IOException { | ||
String lhs = "<parameter xml:space=\"preserve\"> </parameter>"; | ||
|
||
String rhs = "<parameter>recessive</parameter>"; | ||
|
@@ -127,6 +127,20 @@ public void testOverwriteDominantBlankValue() throws XmlPullParserException, IOE | |
assertEquals( " ", mergeResult.getValue() ); | ||
} | ||
|
||
@Test | ||
public void testPreserveDominantEmptyNode() throws XmlPullParserException, IOException | ||
{ | ||
String lhs = "<parameter></parameter>"; | ||
This comment has been minimized.
Sorry, something went wrong.
gnodet
Member
|
||
|
||
String rhs = "<parameter>recessive</parameter>"; | ||
|
||
Xpp3Dom leftDom = Xpp3DomBuilder.build( new StringReader( lhs ), new FixedInputLocationBuilder( "left" ) ); | ||
Xpp3Dom rightDom = Xpp3DomBuilder.build( new StringReader( rhs ), new FixedInputLocationBuilder( "right" ) ); | ||
|
||
Xpp3Dom mergeResult = Xpp3DomUtils.mergeXpp3Dom( leftDom, rightDom, true ); | ||
assertEquals( "", mergeResult.getValue() ); | ||
} | ||
|
||
@Test | ||
public void testIsNotEmptyNegatesIsEmpty() | ||
{ | ||
|
Cross posting it from apache/maven#866 (comment).
@kwin @michael-o Why has this behavior been removed? Is there a migration path that you can share?
The following example has worked before that change where we have a parent pom and a child pom and a configuration that we'd like to merge. Here the parent and child pom definitions:
And the expected effective child pom that is used after the merge:
The problem we see now after this change, is that it will be merged the following way:
The problems are the following:
maven-compiler-plugin
configuration the<bar>
node is not merged from the parent pom configuration but rather the one from themaven-surefire-plugin
configuration from the parent pom.maven-surefire-plugin
configuration not as expected as the children of the<properties>
node are not appended as configured via thecombine.children="append"
property.Is that changed something that stays for Maven 4 ? I assume that then a migration path should be given as there are projects that use the behavior before this change and it would result in different effective pom files, which will change how the build is configured.
I asked about it on the ASF Slack here already and it seems this is the right place for it.