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