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


##########
its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7228LeakyModelTest.java:
##########
@@ -33,6 +34,7 @@ protected MavenITmng7228LeakyModelTest() {
         super();
     }
 
+    @Disabled("Disabled because the maven-shade-plugin incorrectly derives 
namespace URIs from model versions")

Review Comment:
   ⚠️ **Avoids root cause:** This test is disabled with `@Disabled` citing 
`maven-shade-plugin` as the root cause, but the fix belongs either in Maven 
itself or in the shade plugin. Disabling the IT hides the regression. If this 
is a known external plugin issue, consider filing a bug upstream and tracking 
it with an issue reference rather than silently disabling the test.



##########
impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultModelXmlFactory.java:
##########
@@ -63,7 +63,7 @@ public Model read(@Nonnull XmlReaderRequest request) throws 
XmlReaderException {
         requireNonNull(request, "request");
         Model model = doRead(request);
         if (isModelVersionGreaterThan400(model)
-                && 
!model.getNamespaceUri().startsWith("http://maven.apache.org/POM/";)) {
+                && 
!model.getNamespaceUri().equals("http://maven.apache.org/POM/4.0.0";)) {

Review Comment:
   ⚠️ **Compatibility regression:** Changing from 
`startsWith("http://maven.apache.org/POM/";)` to 
`equals("http://maven.apache.org/POM/4.0.0";)` means any POM with a 4.1.0 or 
4.2.0 namespace URI will now throw an `XmlReaderException` where it previously 
passed. If the intent is to restrict namespace handling to 4.0.0 POMs in this 
path, this needs to be documented, tested for the rejection behavior, and 
confirmed to not break existing 4.1.0 workloads.



##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/ModelUpgradeStrategy.java:
##########
@@ -181,7 +180,7 @@ private void upgradeNamespaceAndSchemaLocation(Editor 
editor, UpgradeContext con
         }
 
         // Update namespace based on target model version
-        String targetNamespace = 
getNamespaceForModelVersion(targetModelVersion);
+        String targetNamespace = Namespaces.MAVEN_4_0_0_NAMESPACE;

Review Comment:
   📝 **Stale comment:** The comment on line 182 reads `// Update namespace 
based on target model version`, but the code now hardcodes 
`Namespaces.MAVEN_4_0_0_NAMESPACE` regardless of `targetModelVersion`. Update 
the comment to reflect the actual behavior (e.g. `// Always upgrade to Maven 
4.0.0 namespace`).



##########
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/goals/UpgradeConstants.java:
##########
@@ -0,0 +1,234 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.cling.invoker.mvnup.goals;
+
+/**
+ * Constants used throughout the Maven upgrade tools.
+ * Organized into logical groups for better maintainability.
+ */
+public final class UpgradeConstants {

Review Comment:
   ⚠️ **Dead code:** This 234-line class is never imported or referenced by any 
other file in this PR. The constants it defines (`ModelVersions`, `Namespaces`, 
schema locations) duplicate those already available from `MavenPomElements`, 
which other files in this PR already import. Please remove this file and use 
the existing constants from `MavenPomElements` instead.



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