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
24 import org.apache.maven.artifact.Artifact;
25 import org.apache.maven.artifact.ArtifactUtils;
26 import org.apache.maven.plugins.dependency.utils.DependencyUtil;
27 import org.apache.maven.shared.dependencies.DependableCoordinate;
28 import org.codehaus.plexus.util.StringUtils;
29
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 public ArtifactItem()
125 {
126
127 }
128
129 public ArtifactItem( Artifact artifact )
130 {
131 this.setArtifact( artifact );
132 this.setArtifactId( artifact.getArtifactId() );
133 this.setClassifier( artifact.getClassifier() );
134 this.setGroupId( artifact.getGroupId() );
135 this.setType( artifact.getType() );
136 this.setVersion( artifact.getVersion() );
137 }
138
139 private String filterEmptyString( String in )
140 {
141 if ( "".equals( in ) )
142 {
143 return null;
144 }
145 return in;
146 }
147
148
149
150
151 public String getArtifactId()
152 {
153 return artifactId;
154 }
155
156
157
158
159 public void setArtifactId( String artifact )
160 {
161 this.artifactId = filterEmptyString( artifact );
162 }
163
164
165
166
167 public String getGroupId()
168 {
169 return groupId;
170 }
171
172
173
174
175 public void setGroupId( String groupId )
176 {
177 this.groupId = filterEmptyString( groupId );
178 }
179
180
181
182
183 public String getType()
184 {
185 return type;
186 }
187
188
189
190
191 public void setType( String type )
192 {
193 this.type = filterEmptyString( type );
194 }
195
196
197
198
199 public String getVersion()
200 {
201 return version;
202 }
203
204
205
206
207 public void setVersion( String version )
208 {
209 this.version = filterEmptyString( version );
210 }
211
212
213
214
215 public String getBaseVersion()
216 {
217 return ArtifactUtils.toSnapshotVersion( version );
218 }
219
220
221
222
223 public String getClassifier()
224 {
225 return classifier;
226 }
227
228
229
230
231 public void setClassifier( String classifier )
232 {
233 this.classifier = filterEmptyString( classifier );
234 }
235
236 @Override
237 public String toString()
238 {
239 if ( this.classifier == null )
240 {
241 return groupId + ":" + artifactId + ":" + StringUtils.defaultString( version, "?" ) + ":" + type;
242 }
243 else
244 {
245 return groupId + ":" + artifactId + ":" + classifier + ":" + StringUtils.defaultString( version, "?" ) + ":"
246 + type;
247 }
248 }
249
250
251
252
253 public File getOutputDirectory()
254 {
255 return outputDirectory;
256 }
257
258
259
260
261 public void setOutputDirectory( File outputDirectory )
262 {
263 this.outputDirectory = outputDirectory;
264 }
265
266
267
268
269 public String getDestFileName()
270 {
271 return destFileName;
272 }
273
274
275
276
277 public void setDestFileName( String destFileName )
278 {
279 this.destFileName = filterEmptyString( destFileName );
280 }
281
282
283
284
285 public boolean isNeedsProcessing()
286 {
287 return this.needsProcessing;
288 }
289
290
291
292
293 public void setNeedsProcessing( boolean needsProcessing )
294 {
295 this.needsProcessing = needsProcessing;
296 }
297
298
299
300
301 public String getOverWrite()
302 {
303 return this.overWrite;
304 }
305
306
307
308
309 public void setOverWrite( String overWrite )
310 {
311 this.overWrite = overWrite;
312 }
313
314
315
316
317
318 public String getEncoding()
319 {
320 return this.encoding;
321 }
322
323
324
325
326
327 public void setEncoding( String encoding )
328 {
329 this.encoding = encoding;
330 }
331
332
333
334
335 public Artifact getArtifact()
336 {
337 return this.artifact;
338 }
339
340
341
342
343 public void setArtifact( Artifact artifact )
344 {
345 this.artifact = artifact;
346 }
347
348
349
350
351 public String getExcludes()
352 {
353 return DependencyUtil.cleanToBeTokenizedString( this.excludes );
354 }
355
356
357
358
359 public void setExcludes( String excludes )
360 {
361 this.excludes = excludes;
362 }
363
364
365
366
367 public String getIncludes()
368 {
369 return DependencyUtil.cleanToBeTokenizedString( this.includes );
370 }
371
372
373
374
375 public void setIncludes( String includes )
376 {
377 this.includes = includes;
378 }
379 }