private void mergeProjectDependencies(Set<Artifact> projectDependencies) {
// Go over all the artifacts taken from the MavenProject object, and replace their equals method, so that we are
// able to merge them together with the artifacts inside the resolvedArtifacts set:
Set<Artifact> dependecies = Sets.newHashSet();
for(Artifact artifact : projectDependencies) {
DefaultArtifact art = new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
artifact.getScope(), artifact.getType(), "", artifact.getArtifactHandler()) {
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof org.apache.maven.artifact.Artifact)) {
return false;
}
return hashCode() == o.hashCode();
}
};
art.setFile(artifact.getFile());
dependecies.add(art);
}
// Now we merge the artifacts from the two collections. In case an artifact is included in both collections, we'd like to keep
// the one that was taken from the MavenProject, because of the scope it has.