39
39
import org .eclipse .aether .graph .DefaultDependencyNode ;
40
40
import org .eclipse .aether .graph .Dependency ;
41
41
import org .eclipse .aether .graph .DependencyNode ;
42
+ import org .eclipse .aether .graph .Exclusion ;
42
43
import org .eclipse .aether .impl .ArtifactDescriptorReader ;
43
44
import org .eclipse .aether .impl .RemoteRepositoryManager ;
44
45
import org .eclipse .aether .impl .VersionRangeResolver ;
57
58
import org .eclipse .aether .spi .artifact .decorator .ArtifactDecoratorFactory ;
58
59
import org .eclipse .aether .util .ConfigUtils ;
59
60
import org .eclipse .aether .util .graph .manager .DependencyManagerUtils ;
61
+ import org .eclipse .aether .util .graph .selector .ExclusionDependencySelector ;
60
62
import org .eclipse .aether .version .Version ;
61
63
62
64
/**
@@ -92,12 +94,16 @@ protected void doCollectDependencies(
92
94
List <RemoteRepository > repositories ,
93
95
List <Dependency > dependencies ,
94
96
List <Dependency > managedDependencies ,
97
+ List <Exclusion > exclusions ,
95
98
Results results )
96
99
throws DependencyCollectionException {
100
+ // TODO
97
101
NodeStack nodes = new NodeStack ();
98
102
nodes .push (node );
99
103
100
104
Args args = new Args (session , pool , nodes , context , versionContext , request );
105
+ ExclusionDependencySelector exclusionDependencySelector =
106
+ exclusions == null || exclusions .isEmpty () ? null : new ExclusionDependencySelector (exclusions );
101
107
102
108
process (
103
109
args ,
@@ -114,7 +120,8 @@ protected void doCollectDependencies(
114
120
session .getDependencyTraverser () != null
115
121
? session .getDependencyTraverser ().deriveChildTraverser (context )
116
122
: null ,
117
- session .getVersionFilter () != null ? session .getVersionFilter ().deriveChildFilter (context ) : null );
123
+ session .getVersionFilter () != null ? session .getVersionFilter ().deriveChildFilter (context ) : null ,
124
+ exclusionDependencySelector );
118
125
119
126
if (args .interruptedException .get () != null ) {
120
127
throw new DependencyCollectionException (
@@ -132,7 +139,8 @@ private void process(
132
139
DependencySelector depSelector ,
133
140
DependencyManager depManager ,
134
141
DependencyTraverser depTraverser ,
135
- VersionFilter verFilter ) {
142
+ VersionFilter verFilter ,
143
+ ExclusionDependencySelector exclusionDependencySelector ) {
136
144
if (Thread .interrupted ()) {
137
145
args .interruptedException .set (new InterruptedException ());
138
146
}
@@ -141,7 +149,16 @@ private void process(
141
149
}
142
150
for (Dependency dependency : dependencies ) {
143
151
processDependency (
144
- args , trace , results , repositories , depSelector , depManager , depTraverser , verFilter , dependency );
152
+ args ,
153
+ trace ,
154
+ results ,
155
+ repositories ,
156
+ depSelector ,
157
+ depManager ,
158
+ depTraverser ,
159
+ verFilter ,
160
+ dependency ,
161
+ exclusionDependencySelector );
145
162
}
146
163
}
147
164
@@ -155,7 +172,8 @@ private void processDependency(
155
172
DependencyManager depManager ,
156
173
DependencyTraverser depTraverser ,
157
174
VersionFilter verFilter ,
158
- Dependency dependency ) {
175
+ Dependency dependency ,
176
+ ExclusionDependencySelector exclusionDependencySelector ) {
159
177
160
178
List <Artifact > relocations = Collections .emptyList ();
161
179
processDependency (
@@ -169,7 +187,8 @@ private void processDependency(
169
187
verFilter ,
170
188
dependency ,
171
189
relocations ,
172
- false );
190
+ false ,
191
+ exclusionDependencySelector );
173
192
}
174
193
175
194
@ SuppressWarnings ("checkstyle:parameternumber" )
@@ -184,7 +203,13 @@ private void processDependency(
184
203
VersionFilter verFilter ,
185
204
Dependency dependency ,
186
205
List <Artifact > relocations ,
187
- boolean disableVersionManagement ) {
206
+ boolean disableVersionManagement ,
207
+ ExclusionDependencySelector exclusionDependencySelector ) {
208
+ if (exclusionDependencySelector != null ) {
209
+ if (!exclusionDependencySelector .selectDependency (dependency )) {
210
+ return ;
211
+ }
212
+ }
188
213
if (depSelector != null && !depSelector .selectDependency (dependency )) {
189
214
return ;
190
215
}
@@ -256,7 +281,8 @@ private void processDependency(
256
281
verFilter ,
257
282
d ,
258
283
descriptorResult .getRelocations (),
259
- disableVersionManagementSubsequently );
284
+ disableVersionManagementSubsequently ,
285
+ exclusionDependencySelector );
260
286
return ;
261
287
} else {
262
288
d = args .pool .intern (d .setArtifact (args .pool .intern (d .getArtifact ())));
@@ -290,7 +316,8 @@ private void processDependency(
290
316
verFilter ,
291
317
d ,
292
318
descriptorResult ,
293
- child );
319
+ child ,
320
+ exclusionDependencySelector );
294
321
}
295
322
}
296
323
} else {
@@ -322,7 +349,8 @@ private void doRecurse(
322
349
VersionFilter verFilter ,
323
350
Dependency d ,
324
351
ArtifactDescriptorResult descriptorResult ,
325
- DefaultDependencyNode child ) {
352
+ DefaultDependencyNode child ,
353
+ ExclusionDependencySelector exclusionDependencySelector ) {
326
354
DefaultDependencyCollectionContext context = args .collectionContext .get ();
327
355
args .collectionContext .compareAndSet (context , context .set (d , descriptorResult .getManagedDependencies ()));
328
356
context = args .collectionContext .get ();
@@ -355,7 +383,8 @@ private void doRecurse(
355
383
childSelector ,
356
384
childManager ,
357
385
childTraverser ,
358
- childFilter );
386
+ childFilter ,
387
+ exclusionDependencySelector );
359
388
360
389
args .nodes .pop ();
361
390
} else {
0 commit comments