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


##########
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 f6cb7d6dad: `PomDiscovery` now uses `LinkedHashMap` so discovery 
order (parent before children, as paths are walked depth-first) becomes the 
iteration order for cross-POM property resolution.
   
   Also addressed two other issues in the same commit:
   - IT renamed `MavenITMvnupJarPluginUpgradeTest` → 
`MavenITgh13059MvnupJarPluginUpgradeTest` to follow the `GH-NNNNN` naming 
convention.
   - IT now runs `mvn package` after `mvn --up apply` to verify 
maven-jar-plugin 3.4.1 actually builds cleanly under Maven 4, not just that the 
version string is written.



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