Hi Benson,
Author: bimargulies Date: Sat Dec 10 02:22:55 2011 New Revision: 1212720 [...] @@ -156,12 +159,57 @@ class ReactorReader return null; }- private boolean classifierComparison ( String c1, String c2 ) + /** + * Try to satisfy both MNG-4065 and MNG-5214. Consider jar and test-jar equivalent. + * @param requestedType + * @param artifactType + * @return + */ + private boolean attachedArtifactComparison ( Artifact requestedArtifact, org.apache.maven.artifact.Artifact attachedArtifact ) { - return c1 == null&& c2 == null - || ((c1 != null)&& c1.equals(c2)); + if ( ! requestedArtifact.getGroupId().equals ( attachedArtifact.getGroupId() ) ) + { + return false; + } + if ( ! requestedArtifact.getArtifactId().equals ( attachedArtifact.getArtifactId() ) ) + { + return false; + } + String requestedExtension = requestedArtifact.getExtension(); + String attachedExtension = null; + if ( attachedArtifact.getArtifactHandler() != null ) + { + attachedExtension = attachedArtifact.getArtifactHandler().getExtension(); + } + String requestedType = requestedArtifact.getProperty ( "type", "" ); + String attachedType = attachedArtifact.getType(); + boolean typeOk = false; + + if ( requestedExtension.equals ( attachedExtension ) ) + { + // the ideal case. + typeOk = true; + } + else if ( requestedType.equals( attachedType ) ) + { + typeOk = true; + } + else if ( "test-jar".equals ( requestedType )&& "jar".equals( attachedType ) ) + { + typeOk = true; + } + else if ( "jar".equals ( requestedType )&& "test-jar".equals( attachedType ) ) + { + typeOk = true; + }
Can you describe a case where if ( requestedExtension.equals ( attachedExtension ) ) yields false and any of the else if (...) cases yields true? Benjamin --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
