elharo opened a new issue, #12596:
URL: https://github.com/apache/maven/issues/12596

   # ArtifactCoordinates.getId() produces double colon when classifier is empty
   
   **Found in:** maven-4.0.x branch
   **File:** 
`api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinates.java`
 (lines ~72-78)
   **Severity:** High
   
   ## Description
   
   When `getClassifier()` returns an empty string (the standard case), 
`getId()` produces a double colon:
   
   ```java
   default String getId() {
       String c = getClassifier();
       return getGroupId() + ':' + getArtifactId() + ':' + getExtension()
               + ':' + c      // always adds ":" + c, even when empty
               + (c.isEmpty() ? "" : ":")
               + getVersionConstraint();
   }
   ```
   
   This produces `groupId:artifactId:extension::versionConstraint` — a double 
colon. Compare with the correct `Artifact.key()` method which correctly 
produces `groupId:artifactId:extension:version` when the classifier is empty.
   
   The fix should match the pattern in `Artifact.key()`:
   ```java
   return getGroupId() + ':' + getArtifactId() + ':' + getExtension()
           + (c.isEmpty() ? "" : ":" + c)
           + ':' + getVersionConstraint();
   ```


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