in src/main/java/org/apache/sling/feature/maven/Preprocessor.java [451:488]
private void addDependency(
final Logger logger, final MavenProject project, final ArtifactId id, final String scope) {
if (id.getGroupId().equals(project.getGroupId())
&& id.getArtifactId().equals(project.getArtifactId())
&& id.getVersion().equals(project.getVersion())) {
// skip artifact from the same project
logger.debug("- skipping dependency " + id.toMvnId());
} else {
boolean found = false;
for (final Dependency d : project.getDependencies()) {
if (d.getGroupId().equals(id.getGroupId()) && d.getArtifactId().equals(id.getArtifactId())) {
if (d.getVersion().equals(id.getVersion()) && d.getType().equals(id.getType())) {
if (d.getClassifier() == null && id.getClassifier() == null) {
found = true;
break;
}
if (d.getClassifier() != null && d.getClassifier().equals(id.getClassifier())) {
found = true;
break;
}
}
}
}
if (!found) {
logger.debug("- adding dependency " + id.toMvnId());
final Dependency dep = ProjectHelper.toDependency(id, scope);
// Exclude all transitive dependencies coming from the feature model deps
Exclusion exclusion = new Exclusion();
exclusion.setGroupId("*");
exclusion.setArtifactId("*");
dep.addExclusion(exclusion);
project.getDependencies().add(dep);
}
}
}