You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2025/10/03 08:51:09 UTC

Re: [PR] GH-1609 Bad metadata naming [maven-resolver]

gnodet commented on code in PR #1610:
URL: https://github.com/apache/maven-resolver/pull/1610#discussion_r2401255984


##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/synccontext/named/GAVNameMapper.java:
##########
@@ -103,18 +104,46 @@ private static String getArtifactName(Artifact artifact, String prefix, String s
                 + suffix;
     }
 
+    private static final String MAVEN_METADATA = "maven-metadata.xml";
+
     private static String getMetadataName(Metadata metadata, String prefix, String separator, String suffix) {
-        String name = prefix;
-        if (!metadata.getGroupId().isEmpty()) {
-            name += metadata.getGroupId();
-            if (!metadata.getArtifactId().isEmpty()) {
-                name += separator + metadata.getArtifactId();
-                if (!metadata.getVersion().isEmpty()) {
-                    name += separator + metadata.getVersion();
+        if (metadata.getType().contains("/")) {
+            String metadataType = metadata.getType();
+            int slash = metadataType.indexOf('/');
+            return metadataType.substring(0, slash)
+                    + separator
+                    + getMetadataName(
+                            new DefaultMetadata(

Review Comment:
   It looks inefficient to create an object just to call the method recursively.  It may be cleaner to define a new method which would have the individual parameters.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org