gnodet commented on code in PR #13059:
URL: https://github.com/apache/maven/pull/13059#discussion_r4044740431


##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/PluginUpgradeStrategy.java:
##########
@@ -523,49 +540,106 @@ && isPropertyUsedByQuarkusBom(pomDocument, 
propertyName)) {
 
     /**
      * Upgrades a property value if it represents a plugin version below the 
minimum.
+     * First checks the current POM's properties, then searches other POMs in 
the project
+     * (e.g., parent POMs) if the property is not found locally.
      */
     private boolean upgradePropertyVersion(
             Document pomDocument,
+            Map<Path, Document> pomMap,
             String propertyName,
             PluginUpgradeInfo upgrade,
             String sectionName,
             UpgradeContext context) {
-        Editor editor = new Editor(pomDocument);
-        Element root = editor.root();
+        // First, try the current POM's properties
+        if (upgradePropertyInDocument(pomDocument, propertyName, upgrade, 
sectionName, context)) {
+            return true;
+        }
+
+        // Check if property exists in the current POM but is already at/above 
minimum (no upgrade needed).
+        // In that case, skip the cross-POM search and the warning — the 
property IS defined.
+        Element currentRoot = pomDocument.root();
+        Element currentProps = 
currentRoot.childElement(PROPERTIES).orElse(null);
+        if (currentProps != null && 
currentProps.childElement(propertyName).isPresent()) {
+            return false; // Found in current POM, no upgrade needed
+        }
+
+        // Property not in current POM — search other POMs in the project 
(e.g., parent POM)
+        for (Map.Entry<Path, Document> entry : pomMap.entrySet()) {

Review Comment:
   Fixed in a807f45274. Switched `PomDiscovery` to `LinkedHashMap` — discovery 
order is already deterministic (root POM first, then modules in declaration 
order recursively), so `LinkedHashMap` preserves the natural 
parent-before-children ordering without further changes.



-- 
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]

Reply via email to