rmannibucau commented on code in PR #12160:
URL: https://github.com/apache/maven/pull/12160#discussion_r3343061996
##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/CompatibilityFixStrategy.java:
##########
@@ -164,44 +168,44 @@ public UpgradeResult doApply(UpgradeContext context,
Map<Path, Document> pomMap)
/**
* Fixes unsupported combine.children attribute values.
- * Maven 4 only supports 'append' and 'merge', not 'override'.
+ * Maven 4 only supports 'append' and 'merge' (default is merge).
+ * Invalid values are removed entirely since Maven 3 silently ignored them.
*/
private boolean fixUnsupportedCombineChildrenAttributes(Document
pomDocument, UpgradeContext context) {
- boolean fixed = false;
Element root = pomDocument.root();
- // Find all elements with combine.children="override" and change to
"merge"
- long fixedCombineChildrenCount = findElementsWithAttribute(root,
COMBINE_CHILDREN, COMBINE_OVERRIDE)
- .peek(element -> {
-
element.attributeObject(COMBINE_CHILDREN).value(COMBINE_MERGE);
- context.detail("Fixed: " + COMBINE_CHILDREN + "='" +
COMBINE_OVERRIDE + "' → '" + COMBINE_MERGE
- + "' in " + element.name());
- })
- .count();
- fixed |= fixedCombineChildrenCount > 0;
+ List<Element> invalidElements = findElementsWithInvalidAttribute(
+ root, COMBINE_CHILDREN, VALID_COMBINE_CHILDREN_VALUES)
+ .toList();
- return fixed;
+ for (Element element : invalidElements) {
Review Comment:
do we want to fail and only run on a valid pom? (to encourage people to
review instead of doing a blind silent migration which can just not be desired)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]