Copilot commented on code in PR #799:
URL:
https://github.com/apache/maven-shade-plugin/pull/799#discussion_r2967490596
##########
src/main/java/org/apache/maven/plugins/shade/pom/PomWriter.java:
##########
@@ -41,7 +41,7 @@ public static void write(Writer w, Model newModel, boolean
namespaceDeclaration)
if (namespaceDeclaration) {
String modelVersion = newModel.getModelVersion();
- Namespace pomNamespace = Namespace.getNamespace("",
"http://maven.apache.org/POM/" + modelVersion);
+ Namespace pomNamespace =
Namespace.getNamespace("http://maven.apache.org/POM/4.0.0");
Review Comment:
The POM namespace URL is now hardcoded here, but the same literal is
repeated again in the schemaLocation attribute below. Consider extracting it
into a single constant (or deriving schemaLocation from the Namespace URI) to
avoid future drift if this ever needs to change.
##########
src/main/java/org/apache/maven/plugins/shade/pom/PomWriter.java:
##########
@@ -52,7 +52,7 @@ public static void write(Writer w, Model newModel, boolean
namespaceDeclaration)
if (root.getAttribute("schemaLocation", xsiNamespace) == null) {
root.setAttribute(
"schemaLocation",
- "http://maven.apache.org/POM/" + modelVersion + "
http://maven.apache.org/maven-v"
+ "http://maven.apache.org/POM/4.0.0" + "
http://maven.apache.org/maven-v"
Review Comment:
This concatenation joins two string literals (".../4.0.0" + " http://...")
which is harder to read than a single literal. Collapsing it into one string
(or building it from constants) would improve readability.
```suggestion
"http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v"
```
--
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]