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 abstract class AbstractScopeArtifactFilter implements ArtifactFilter {
28
29 private boolean compileScope;
30
31 private boolean runtimeScope;
32
33 private boolean testScope;
34
35 private boolean providedScope;
36
37 private boolean systemScope;
38
39 void addScopeInternal(String scope) {
40 if (Artifact.SCOPE_COMPILE.equals(scope)) {
41 systemScope = true;
42 providedScope = true;
43 compileScope = true;
44 } else if (Artifact.SCOPE_RUNTIME.equals(scope)) {
45 compileScope = true;
46 runtimeScope = true;
47 } else if (Artifact.SCOPE_COMPILE_PLUS_RUNTIME.equals(scope)) {
48 systemScope = true;
49 providedScope = true;
50 compileScope = true;
51 runtimeScope = true;
52 } else if (Artifact.SCOPE_RUNTIME_PLUS_SYSTEM.equals(scope)) {
53 systemScope = true;
54 compileScope = true;
55 runtimeScope = true;
56 } else if (Artifact.SCOPE_TEST.equals(scope)) {
57 systemScope = true;
58 providedScope = true;
59 compileScope = true;
60 runtimeScope = true;
61 testScope = true;
62 }
63 }
64
65 public boolean include(Artifact artifact) {
66 if (Artifact.SCOPE_COMPILE.equals(artifact.getScope())) {
67 return compileScope;
68 } else if (Artifact.SCOPE_RUNTIME.equals(artifact.getScope())) {
69 return runtimeScope;
70 } else if (Artifact.SCOPE_TEST.equals(artifact.getScope())) {
71 return testScope;
72 } else if (Artifact.SCOPE_PROVIDED.equals(artifact.getScope())) {
73 return providedScope;
74 } else if (Artifact.SCOPE_SYSTEM.equals(artifact.getScope())) {
75 return systemScope;
76 } else {
77 return true;
78 }
79 }
80 }