Index: src/java/org/apache/ivy/core/module/id/ArtifactRevisionId.java =================================================================== --- src/java/org/apache/ivy/core/module/id/ArtifactRevisionId.java (revision 1208940) +++ src/java/org/apache/ivy/core/module/id/ArtifactRevisionId.java (working copy) @@ -17,6 +17,7 @@ */ package org.apache.ivy.core.module.id; +import java.util.HashMap; import java.util.Map; import org.apache.ivy.core.IvyPatternHelper; @@ -24,7 +25,7 @@ /** * Identifies an artifact in a particular module revision - * + * * @see org.apache.ivy.core.module.id */ public class ArtifactRevisionId extends UnmodifiableExtendableItem { @@ -48,7 +49,7 @@ } public ArtifactRevisionId(ArtifactId artfId, ModuleRevisionId mdlRevId, Map extraAttributes) { - super(null, extraAttributes); + super(null, prepareExtraAttribute(artfId,extraAttributes)); artifactId = artfId; mrid = mdlRevId; @@ -61,6 +62,20 @@ setStandardAttribute(IvyPatternHelper.EXT_KEY, getExt()); } + public static Map prepareExtraAttribute(ArtifactId artfId,Map extraAttributes) { + final String type = artfId.getType(); + final String ext = artfId.getExt(); + if((!("jar".equals(type))&&"jar".equals(ext) )&& (extraAttributes == null || !extraAttributes.containsKey("classifier"))){ + if( extraAttributes == null){ + extraAttributes = new HashMap(); + }else{ + extraAttributes = new HashMap(extraAttributes); + } + extraAttributes.put("m:classifier", type); + } + return extraAttributes; + } + public boolean equals(Object obj) { if (!(obj instanceof ArtifactRevisionId)) { return false; @@ -79,13 +94,13 @@ hash += getModuleRevisionId().hashCode() * 37; hash += getQualifiedExtraAttributes().hashCode() * 37; //CheckStyle:MagicNumber| ON - + return hash; } public String toString() { return getModuleRevisionId() - + "!" + getName() + "." + getExt() + + "!" + getName() + "." + getExt() + (getType().equals(getExt()) ? "" : "(" + getType() + ")"); }