final String groupId = cartridgeArtifact.getGroupId();
final String artifactId = cartridgeArtifact.getArtifactId();
final String type = cartridgeArtifact.getType();
if (groupId == null || artifactId == null)
{
throw new MojoFailureException("Could not resolve cartridge artifact [" + groupId + ":" + artifactId +
":" + type + "]");
}
for (final Iterator iterator = artifacts.iterator(); iterator.hasNext();)
{
final Artifact artifact = (Artifact)iterator.next();
if (artifact.getGroupId().equals(groupId) && artifact.getArtifactId().equals(artifactId) &&
(type == null || artifact.getType().equals(type)))
{
resolvedArtifact = artifact;
break;
}
}
if (resolvedArtifact == null)
{
// Artifact has not been found
throw new MojoFailureException("Artifact[" + groupId + ":" + artifactId + ":" + type + "] " +
"is not a dependency of the project.");
}
return resolvedArtifact;
}
return resolvedArtifact;