1 package org.apache.maven.plugins.dependency.fromConfiguration;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23 import java.util.Objects;
24
25 import org.apache.maven.artifact.Artifact;
26 import org.apache.maven.artifact.ArtifactUtils;
27 import org.apache.maven.plugins.dependency.utils.DependencyUtil;
28 import org.apache.maven.shared.transfer.dependencies.DependableCoordinate;
29 import org.codehaus.plexus.components.io.filemappers.FileMapper;
30
31
32
33
34
35
36
37 public class ArtifactItem
38 implements DependableCoordinate
39 {
40
41
42
43
44
45
46 private String groupId;
47
48
49
50
51
52
53
54 private String artifactId;
55
56
57
58
59
60
61 private String version = null;
62
63
64
65
66
67
68
69 private String type = "jar";
70
71
72
73
74
75
76 private String classifier;
77
78
79
80
81
82
83 private File outputDirectory;
84
85
86
87
88
89
90 private String destFileName;
91
92
93
94
95 private String overWrite;
96
97
98
99
100
101
102 private String encoding;
103
104
105
106
107 private boolean needsProcessing;
108
109
110
111
112 private Artifact artifact;
113
114
115
116
117 private String includes;
118
119
120
121
122 private String excludes;
123
124
125
126
127
128
129
130
131 private FileMapper[] fileMappers;
132
133
134
135
136 public ArtifactItem()
137 {
138
139 }
140
141
142
143
144 public ArtifactItem( Artifact artifact )
145 {
146 this.setArtifact( artifact );
147 this.setArtifactId( artifact.getArtifactId() );
148 this.setClassifier( artifact.getClassifier() );
149 this.setGroupId( artifact.getGroupId() );
150 this.setType( artifact.getType() );
151 this.setVersion( artifact.getVersion() );
152 }
153
154 private String filterEmptyString( String in )
155 {
156 if ( "".equals( in ) )
157 {
158 return null;
159 }
160 return in;
161 }
162
163
164
165
166 public String getArtifactId()
167 {
168 return artifactId;
169 }
170
171
172
173
174 public void setArtifactId( String theArtifact )
175 {
176 this.artifactId = filterEmptyString( theArtifact );
177 }
178
179
180
181
182 public String getGroupId()
183 {
184 return groupId;
185 }
186
187
188
189
190 public void setGroupId( String groupId )
191 {
192 this.groupId = filterEmptyString( groupId );
193 }
194
195
196
197
198 public String getType()
199 {
200 return type;
201 }
202
203
204
205
206 public void setType( String type )
207 {
208 this.type = filterEmptyString( type );
209 }
210
211
212
213
214 public String getVersion()
215 {
216 return version;
217 }
218
219
220
221
222 public void setVersion( String version )
223 {
224 this.version = filterEmptyString( version );
225 }
226
227
228
229
230 public String getBaseVersion()
231 {
232 return ArtifactUtils.toSnapshotVersion( version );
233 }
234
235
236
237
238 public String getClassifier()
239 {
240 return classifier;
241 }
242
243
244
245
246 public void setClassifier( String classifier )
247 {
248 this.classifier = filterEmptyString( classifier );
249 }
250
251 @Override
252 public String toString()
253 {
254 if ( this.classifier == null )
255 {
256 return groupId + ":" + artifactId + ":" + Objects.toString( version, "?" ) + ":" + type;
257 }
258 else
259 {
260 return groupId + ":" + artifactId + ":" + classifier + ":" + Objects.toString( version, "?" ) + ":"
261 + type;
262 }
263 }
264
265
266
267
268 public File getOutputDirectory()
269 {
270 return outputDirectory;
271 }
272
273
274
275
276 public void setOutputDirectory( File outputDirectory )
277 {
278 this.outputDirectory = outputDirectory;
279 }
280
281
282
283
284 public String getDestFileName()
285 {
286 return destFileName;
287 }
288
289
290
291
292 public void setDestFileName( String destFileName )
293 {
294 this.destFileName = filterEmptyString( destFileName );
295 }
296
297
298
299
300 public boolean isNeedsProcessing()
301 {
302 return this.needsProcessing;
303 }
304
305
306
307
308 public void setNeedsProcessing( boolean needsProcessing )
309 {
310 this.needsProcessing = needsProcessing;
311 }
312
313
314
315
316 public String getOverWrite()
317 {
318 return this.overWrite;
319 }
320
321
322
323
324 public void setOverWrite( String overWrite )
325 {
326 this.overWrite = overWrite;
327 }
328
329
330
331
332
333 public String getEncoding()
334 {
335 return this.encoding;
336 }
337
338
339
340
341
342 public void setEncoding( String encoding )
343 {
344 this.encoding = encoding;
345 }
346
347
348
349
350 public Artifact getArtifact()
351 {
352 return this.artifact;
353 }
354
355
356
357
358 public void setArtifact( Artifact artifact )
359 {
360 this.artifact = artifact;
361 }
362
363
364
365
366 public String getExcludes()
367 {
368 return DependencyUtil.cleanToBeTokenizedString( this.excludes );
369 }
370
371
372
373
374 public void setExcludes( String excludes )
375 {
376 this.excludes = excludes;
377 }
378
379
380
381
382 public String getIncludes()
383 {
384 return DependencyUtil.cleanToBeTokenizedString( this.includes );
385 }
386
387
388
389
390 public void setIncludes( String includes )
391 {
392 this.includes = includes;
393 }
394
395
396
397
398
399
400
401 public FileMapper[] getFileMappers()
402 {
403 return this.fileMappers;
404 }
405
406
407
408
409
410
411
412 public void setFileMappers( FileMapper[] fileMappers )
413 {
414 this.fileMappers = fileMappers;
415 }
416 }