1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.artifact.resolver.filter;
20
21 import org.apache.maven.artifact.Artifact;
22
23
24
25
26
27
28 abstract class AbstractScopeArtifactFilter implements ArtifactFilter {
29
30 private boolean compileScope;
31
32 private boolean runtimeScope;
33
34 private boolean testScope;
35
36 private boolean providedScope;
37
38 private boolean systemScope;
39
40 void addScopeInternal(String scope) {
41 if (Artifact.SCOPE_COMPILE.equals(scope)) {
42 systemScope = true;
43 providedScope = true;
44 compileScope = true;
45 } else if (Artifact.SCOPE_RUNTIME.equals(scope)) {
46 compileScope = true;
47 runtimeScope = true;
48 } else if (Artifact.SCOPE_COMPILE_PLUS_RUNTIME.equals(scope)) {
49 systemScope = true;
50 providedScope = true;
51 compileScope = true;
52 runtimeScope = true;
53 } else if (Artifact.SCOPE_RUNTIME_PLUS_SYSTEM.equals(scope)) {
54 systemScope = true;
55 compileScope = true;
56 runtimeScope = true;
57 } else if (Artifact.SCOPE_TEST.equals(scope)) {
58 systemScope = true;
59 providedScope = true;
60 compileScope = true;
61 runtimeScope = true;
62 testScope = true;
63 }
64 }
65
66 public boolean include(Artifact artifact) {
67 if (Artifact.SCOPE_COMPILE.equals(artifact.getScope())) {
68 return compileScope;
69 } else if (Artifact.SCOPE_RUNTIME.equals(artifact.getScope())) {
70 return runtimeScope;
71 } else if (Artifact.SCOPE_TEST.equals(artifact.getScope())) {
72 return testScope;
73 } else if (Artifact.SCOPE_PROVIDED.equals(artifact.getScope())) {
74 return providedScope;
75 } else if (Artifact.SCOPE_SYSTEM.equals(artifact.getScope())) {
76 return systemScope;
77 } else {
78 return true;
79 }
80 }
81 }