提交 f02c8633 编写于 作者: J jurgen

Dependency exclusions

Former-commit-id: 98343ea9
上级 545eab6c
......@@ -21,6 +21,7 @@ import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import java.io.IOException;
import java.util.List;
/**
* Maven artifact license references
......@@ -38,6 +39,7 @@ public class MavenArtifactDependency extends MavenArtifactReference {
private Scope scope;
private boolean optional;
private List<MavenArtifactReference> exclusions;
public MavenArtifactDependency(@NotNull String groupId, @NotNull String artifactId, @NotNull String version, Scope scope, boolean optional) {
super(groupId, artifactId, version);
......@@ -53,6 +55,10 @@ public class MavenArtifactDependency extends MavenArtifactReference {
return optional;
}
public List<MavenArtifactReference> getExclusions() {
return exclusions;
}
public MavenLocalVersion resolveDependency(DBRProgressMonitor monitor) throws IOException {
MavenArtifact depArtifact = MavenRegistry.getInstance().findArtifact(this);
if (depArtifact != null) {
......@@ -61,4 +67,8 @@ public class MavenArtifactDependency extends MavenArtifactReference {
return null;
}
void addExclusion(MavenArtifactReference ref) {
exclusions.add(ref);
}
}
......@@ -253,14 +253,28 @@ public class MavenArtifactVersion {
boolean optional = CommonUtils.getBoolean(XMLUtils.getChildElementBody(dep, "optional"), false);
// TODO: maybe we should include some of them
if (all || (!optional && (scope == MavenArtifactDependency.Scope.COMPILE || scope == MavenArtifactDependency.Scope.RUNTIME))) {
result.add(new MavenArtifactDependency(
evaluateString(groupId),
evaluateString(artifactId),
evaluateString(version),
scope,
optional
));
if (!all && !optional && scope != MavenArtifactDependency.Scope.COMPILE && scope == MavenArtifactDependency.Scope.RUNTIME) {
continue;
}
MavenArtifactDependency dependency = new MavenArtifactDependency(
evaluateString(groupId),
evaluateString(artifactId),
evaluateString(version),
scope,
optional
);
result.add(dependency);
// Exclusions
Element exclusionsElement = XMLUtils.getChildElement(dep, "exclusions");
if (exclusionsElement != null) {
for (Element exclusion : XMLUtils.getChildElementList(exclusionsElement, "exclusion")) {
dependency.addExclusion(
new MavenArtifactReference(
CommonUtils.notEmpty(XMLUtils.getChildElementBody(exclusion, "groupId")),
CommonUtils.notEmpty(XMLUtils.getChildElementBody(exclusion, "artifactId")),
""));
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册