Include exclusions in the poms generated for mods (#262)

dev/0.11
zml 2020-08-26 11:33:40 -07:00 committed by GitHub
parent 032c815d19
commit c0ef536be4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -38,6 +38,8 @@ import org.gradle.api.Task;
import org.gradle.api.UnknownTaskException;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.artifacts.ExcludeRule;
import org.gradle.api.artifacts.ModuleDependency;
import org.gradle.api.artifacts.repositories.MavenArtifactRepository;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginConvention;
@ -397,6 +399,20 @@ public class AbstractPlugin implements Plugin<Project> {
depNode.appendNode("artifactId", dependency.getName());
depNode.appendNode("version", dependency.getVersion());
depNode.appendNode("scope", entry.getMavenScope());
if (dependency instanceof ModuleDependency) {
final Set<ExcludeRule> exclusions = ((ModuleDependency) dependency).getExcludeRules();
if (!exclusions.isEmpty()) {
Node exclusionsNode = depNode.appendNode("exclusions");
for (ExcludeRule rule : exclusions) {
Node exclusionNode = exclusionsNode.appendNode("exclusion");
exclusionNode.appendNode("groupId", rule.getGroup() == null ? "*" : rule.getGroup());
exclusionNode.appendNode("artifactId", rule.getModule() == null ? "*" : rule.getModule());
}
}
}
}
}));
}