@Override
public boolean install() {
final DependencyFacet depFacet = getProject().getFacet(DependencyFacet.class);
final MavenFacet coreFacet = getProject().getFacet(MavenFacet.class);
final VersionFacet versionFacet = getProject().getFacet(VersionFacet.class);
for (DependencyBuilder dep : coreDependencies) {
depFacet.addDirectDependency(getDependencyWithVersion(dep, versionFacet));
}
for (Entry<String, Collection<DependencyBuilder>> entry : profileDependencies.entrySet()) {
addDependenciesToProfile(entry.getKey(), entry.getValue(), versionFacet);
}
final Model pom = coreFacet.getModel();
final Map<String, Collection<DependencyBuilder>> blacklistProfileDependencies = new HashMap<String, Collection<DependencyBuilder>>();
for (String profileId : ArtifactVault.getBlacklistProfiles()) {
final Profile profile = MavenModelUtil.getProfileById(profileId, pom.getProfiles());
for (final DependencyArtifact artifact : ArtifactVault.getBlacklistedArtifacts(profileId)) {
final DependencyBuilder dep = getDependency(artifact);
if (depFacet.hasEffectiveDependency(dep)
&& !hasProvidedDependency(profile, dep)) {
final org.jboss.forge.addon.dependencies.Dependency existing = depFacet.getEffectiveDependency(dep);
if (!versionFacet.isManaged(dep))
dep.setVersion(existing.getCoordinate().getVersion());
dep.setScopeType("provided");
if (!blacklistProfileDependencies.containsKey(profileId))
blacklistProfileDependencies.put(profileId, new ArrayList<DependencyBuilder>());
blacklistProfileDependencies.get(profileId).add(dep);