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