1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.aether.util.graph.transformer;
20
21 import org.eclipse.aether.RepositoryException;
22 import org.eclipse.aether.util.artifact.DependencyScopes;
23 import org.eclipse.aether.util.artifact.JavaScopes;
24 import org.eclipse.aether.util.graph.transformer.ConflictResolver.ScopeContext;
25 import org.eclipse.aether.util.graph.transformer.ConflictResolver.ScopeDeriver;
26
27
28
29
30
31
32
33
34 @Deprecated
35 public final class JavaScopeDeriver extends ScopeDeriver {
36
37
38
39
40 public JavaScopeDeriver() {}
41
42 @Override
43 public void deriveScope(ScopeContext context) throws RepositoryException {
44 context.setDerivedScope(getDerivedScope(context.getParentScope(), context.getChildScope()));
45 }
46
47 private String getDerivedScope(String parentScope, String childScope) {
48 String derivedScope;
49
50 if (JavaScopes.SYSTEM.equals(childScope) || JavaScopes.TEST.equals(childScope)) {
51 derivedScope = childScope;
52 } else if (parentScope == null || parentScope.isEmpty() || JavaScopes.COMPILE.equals(parentScope)) {
53 derivedScope = childScope;
54 } else if (JavaScopes.TEST.equals(parentScope) || JavaScopes.RUNTIME.equals(parentScope)) {
55 derivedScope = parentScope;
56 } else if (JavaScopes.SYSTEM.equals(parentScope) || JavaScopes.PROVIDED.equals(parentScope)) {
57 derivedScope = JavaScopes.PROVIDED;
58 } else {
59 derivedScope = JavaScopes.RUNTIME;
60 }
61
62 return derivedScope;
63 }
64 }