Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Assembly |
|
| 1.1842105263157894;1.184 |
1 | /* | |
2 | * $Id$ | |
3 | */ | |
4 | ||
5 | package org.apache.maven.plugins.assembly.model; | |
6 | ||
7 | /** | |
8 | * | |
9 | * | |
10 | * An assembly defines a collection of files usually | |
11 | * distributed in an | |
12 | * archive format such as zip, tar, or tar.gz that is | |
13 | * generated from a | |
14 | * project. For example, a project could produce a ZIP | |
15 | * assembly which | |
16 | * contains a project's JAR artifact in the root directory, | |
17 | * the | |
18 | * runtime dependencies in a lib/ directory, and a shell | |
19 | * script to launch | |
20 | * a stand-alone application. | |
21 | * | |
22 | * | |
23 | * | |
24 | * @version $Revision$ $Date$ | |
25 | */ | |
26 | 0 | public class Assembly implements java.io.Serializable { |
27 | ||
28 | ||
29 | //--------------------------/ | |
30 | //- Class/Member Variables -/ | |
31 | //--------------------------/ | |
32 | ||
33 | /** | |
34 | * Field id | |
35 | */ | |
36 | private String id; | |
37 | ||
38 | /** | |
39 | * Field formats | |
40 | */ | |
41 | private java.util.List formats; | |
42 | ||
43 | /** | |
44 | * Field includeBaseDirectory | |
45 | */ | |
46 | 0 | private boolean includeBaseDirectory = true; |
47 | ||
48 | /** | |
49 | * Field baseDirectory | |
50 | */ | |
51 | private String baseDirectory; | |
52 | ||
53 | /** | |
54 | * Field includeSiteDirectory | |
55 | */ | |
56 | 0 | private boolean includeSiteDirectory = false; |
57 | ||
58 | /** | |
59 | * Field moduleSets | |
60 | */ | |
61 | private java.util.List moduleSets; | |
62 | ||
63 | /** | |
64 | * Field fileSets | |
65 | */ | |
66 | private java.util.List fileSets; | |
67 | ||
68 | /** | |
69 | * Field files | |
70 | */ | |
71 | private java.util.List files; | |
72 | ||
73 | /** | |
74 | * Field dependencySets | |
75 | */ | |
76 | private java.util.List dependencySets; | |
77 | ||
78 | /** | |
79 | * Field repositories | |
80 | */ | |
81 | private java.util.List repositories; | |
82 | ||
83 | /** | |
84 | * Field componentDescriptors | |
85 | */ | |
86 | private java.util.List componentDescriptors; | |
87 | ||
88 | ||
89 | //-----------/ | |
90 | //- Methods -/ | |
91 | //-----------/ | |
92 | ||
93 | /** | |
94 | * Method addComponentDescriptor | |
95 | * | |
96 | * @param string | |
97 | */ | |
98 | public void addComponentDescriptor(String string) | |
99 | { | |
100 | 0 | getComponentDescriptors().add( string ); |
101 | 0 | } //-- void addComponentDescriptor(String) |
102 | ||
103 | /** | |
104 | * Method addDependencySet | |
105 | * | |
106 | * @param dependencySet | |
107 | */ | |
108 | public void addDependencySet(DependencySet dependencySet) | |
109 | { | |
110 | 0 | getDependencySets().add( dependencySet ); |
111 | 0 | } //-- void addDependencySet(DependencySet) |
112 | ||
113 | /** | |
114 | * Method addFile | |
115 | * | |
116 | * @param fileItem | |
117 | */ | |
118 | public void addFile(FileItem fileItem) | |
119 | { | |
120 | 0 | getFiles().add( fileItem ); |
121 | 0 | } //-- void addFile(FileItem) |
122 | ||
123 | /** | |
124 | * Method addFileSet | |
125 | * | |
126 | * @param fileSet | |
127 | */ | |
128 | public void addFileSet(FileSet fileSet) | |
129 | { | |
130 | 0 | getFileSets().add( fileSet ); |
131 | 0 | } //-- void addFileSet(FileSet) |
132 | ||
133 | /** | |
134 | * Method addFormat | |
135 | * | |
136 | * @param string | |
137 | */ | |
138 | public void addFormat(String string) | |
139 | { | |
140 | 0 | getFormats().add( string ); |
141 | 0 | } //-- void addFormat(String) |
142 | ||
143 | /** | |
144 | * Method addModuleSet | |
145 | * | |
146 | * @param moduleSet | |
147 | */ | |
148 | public void addModuleSet(ModuleSet moduleSet) | |
149 | { | |
150 | 0 | getModuleSets().add( moduleSet ); |
151 | 0 | } //-- void addModuleSet(ModuleSet) |
152 | ||
153 | /** | |
154 | * Method addRepository | |
155 | * | |
156 | * @param repository | |
157 | */ | |
158 | public void addRepository(Repository repository) | |
159 | { | |
160 | 0 | getRepositories().add( repository ); |
161 | 0 | } //-- void addRepository(Repository) |
162 | ||
163 | /** | |
164 | * Get | |
165 | * Sets the base directory of the resulting | |
166 | * assembly archive. If this is not | |
167 | * set and includeBaseDirectory == true, | |
168 | * ${project.build.finalName} will be used instead. | |
169 | * (Since 2.2) | |
170 | * | |
171 | */ | |
172 | public String getBaseDirectory() | |
173 | { | |
174 | 0 | return this.baseDirectory; |
175 | } //-- String getBaseDirectory() | |
176 | ||
177 | /** | |
178 | * Method getComponentDescriptors | |
179 | */ | |
180 | public java.util.List getComponentDescriptors() | |
181 | { | |
182 | 0 | if ( this.componentDescriptors == null ) |
183 | { | |
184 | 0 | this.componentDescriptors = new java.util.ArrayList(); |
185 | } | |
186 | ||
187 | 0 | return this.componentDescriptors; |
188 | } //-- java.util.List getComponentDescriptors() | |
189 | ||
190 | /** | |
191 | * Method getDependencySets | |
192 | */ | |
193 | public java.util.List getDependencySets() | |
194 | { | |
195 | 0 | if ( this.dependencySets == null ) |
196 | { | |
197 | 0 | this.dependencySets = new java.util.ArrayList(); |
198 | } | |
199 | ||
200 | 0 | return this.dependencySets; |
201 | } //-- java.util.List getDependencySets() | |
202 | ||
203 | /** | |
204 | * Method getFileSets | |
205 | */ | |
206 | public java.util.List getFileSets() | |
207 | { | |
208 | 0 | if ( this.fileSets == null ) |
209 | { | |
210 | 0 | this.fileSets = new java.util.ArrayList(); |
211 | } | |
212 | ||
213 | 0 | return this.fileSets; |
214 | } //-- java.util.List getFileSets() | |
215 | ||
216 | /** | |
217 | * Method getFiles | |
218 | */ | |
219 | public java.util.List getFiles() | |
220 | { | |
221 | 0 | if ( this.files == null ) |
222 | { | |
223 | 0 | this.files = new java.util.ArrayList(); |
224 | } | |
225 | ||
226 | 0 | return this.files; |
227 | } //-- java.util.List getFiles() | |
228 | ||
229 | /** | |
230 | * Method getFormats | |
231 | */ | |
232 | public java.util.List getFormats() | |
233 | { | |
234 | 0 | if ( this.formats == null ) |
235 | { | |
236 | 0 | this.formats = new java.util.ArrayList(); |
237 | } | |
238 | ||
239 | 0 | return this.formats; |
240 | } //-- java.util.List getFormats() | |
241 | ||
242 | /** | |
243 | * Get | |
244 | * Sets the id of this assembly. This is a symbolic | |
245 | * name for a | |
246 | * particular assembly of files from this project. | |
247 | * Also, aside from | |
248 | * being used to distinctly name the assembled | |
249 | * package by attaching | |
250 | * its value to the generated archive, the id is | |
251 | * used as your | |
252 | * artifact's classifier when deploying. | |
253 | * | |
254 | */ | |
255 | public String getId() | |
256 | { | |
257 | 0 | return this.id; |
258 | } //-- String getId() | |
259 | ||
260 | /** | |
261 | * Method getModuleSets | |
262 | */ | |
263 | public java.util.List getModuleSets() | |
264 | { | |
265 | 0 | if ( this.moduleSets == null ) |
266 | { | |
267 | 0 | this.moduleSets = new java.util.ArrayList(); |
268 | } | |
269 | ||
270 | 0 | return this.moduleSets; |
271 | } //-- java.util.List getModuleSets() | |
272 | ||
273 | /** | |
274 | * Method getRepositories | |
275 | */ | |
276 | public java.util.List getRepositories() | |
277 | { | |
278 | 0 | if ( this.repositories == null ) |
279 | { | |
280 | 0 | this.repositories = new java.util.ArrayList(); |
281 | } | |
282 | ||
283 | 0 | return this.repositories; |
284 | } //-- java.util.List getRepositories() | |
285 | ||
286 | /** | |
287 | * Get | |
288 | * Includes a base directory in the final archive. | |
289 | * For example, | |
290 | * if you are creating an assembly named | |
291 | * "your-app", setting | |
292 | * includeBaseDirectory to true will create an | |
293 | * archive that | |
294 | * includes this base directory. If this option is | |
295 | * set to false | |
296 | * the archive created will unzip its content to | |
297 | * the current | |
298 | * directory. Default value is true. | |
299 | * | |
300 | */ | |
301 | public boolean isIncludeBaseDirectory() | |
302 | { | |
303 | 0 | return this.includeBaseDirectory; |
304 | } //-- boolean isIncludeBaseDirectory() | |
305 | ||
306 | /** | |
307 | * Get | |
308 | * Includes a site directory in the final archive. | |
309 | * The site directory | |
310 | * location of a project is determined by the | |
311 | * siteDirectory parameter | |
312 | * of the Assembly Plugin. Default value is false. | |
313 | * | |
314 | */ | |
315 | public boolean isIncludeSiteDirectory() | |
316 | { | |
317 | 0 | return this.includeSiteDirectory; |
318 | } //-- boolean isIncludeSiteDirectory() | |
319 | ||
320 | /** | |
321 | * Method removeComponentDescriptor | |
322 | * | |
323 | * @param string | |
324 | */ | |
325 | public void removeComponentDescriptor(String string) | |
326 | { | |
327 | 0 | getComponentDescriptors().remove( string ); |
328 | 0 | } //-- void removeComponentDescriptor(String) |
329 | ||
330 | /** | |
331 | * Method removeDependencySet | |
332 | * | |
333 | * @param dependencySet | |
334 | */ | |
335 | public void removeDependencySet(DependencySet dependencySet) | |
336 | { | |
337 | 0 | getDependencySets().remove( dependencySet ); |
338 | 0 | } //-- void removeDependencySet(DependencySet) |
339 | ||
340 | /** | |
341 | * Method removeFile | |
342 | * | |
343 | * @param fileItem | |
344 | */ | |
345 | public void removeFile(FileItem fileItem) | |
346 | { | |
347 | 0 | getFiles().remove( fileItem ); |
348 | 0 | } //-- void removeFile(FileItem) |
349 | ||
350 | /** | |
351 | * Method removeFileSet | |
352 | * | |
353 | * @param fileSet | |
354 | */ | |
355 | public void removeFileSet(FileSet fileSet) | |
356 | { | |
357 | 0 | getFileSets().remove( fileSet ); |
358 | 0 | } //-- void removeFileSet(FileSet) |
359 | ||
360 | /** | |
361 | * Method removeFormat | |
362 | * | |
363 | * @param string | |
364 | */ | |
365 | public void removeFormat(String string) | |
366 | { | |
367 | 0 | getFormats().remove( string ); |
368 | 0 | } //-- void removeFormat(String) |
369 | ||
370 | /** | |
371 | * Method removeModuleSet | |
372 | * | |
373 | * @param moduleSet | |
374 | */ | |
375 | public void removeModuleSet(ModuleSet moduleSet) | |
376 | { | |
377 | 0 | getModuleSets().remove( moduleSet ); |
378 | 0 | } //-- void removeModuleSet(ModuleSet) |
379 | ||
380 | /** | |
381 | * Method removeRepository | |
382 | * | |
383 | * @param repository | |
384 | */ | |
385 | public void removeRepository(Repository repository) | |
386 | { | |
387 | 0 | getRepositories().remove( repository ); |
388 | 0 | } //-- void removeRepository(Repository) |
389 | ||
390 | /** | |
391 | * Set | |
392 | * Sets the base directory of the resulting | |
393 | * assembly archive. If this is not | |
394 | * set and includeBaseDirectory == true, | |
395 | * ${project.build.finalName} will be used instead. | |
396 | * (Since 2.2) | |
397 | * | |
398 | * | |
399 | * @param baseDirectory | |
400 | */ | |
401 | public void setBaseDirectory(String baseDirectory) | |
402 | { | |
403 | 0 | this.baseDirectory = baseDirectory; |
404 | 0 | } //-- void setBaseDirectory(String) |
405 | ||
406 | /** | |
407 | * Set | |
408 | * | |
409 | * Specifies the shared components xml file | |
410 | * locations to include in the | |
411 | * assembly. The locations specified must be | |
412 | * relative to the basedir of | |
413 | * the project. When multiple componentDescriptors | |
414 | * are found, their | |
415 | * contents are merged. Check out the <a | |
416 | * href="component.html"> | |
417 | * descriptor components</a> for more information. | |
418 | * A | |
419 | * componentDescriptor is specified by providing | |
420 | * one or more of | |
421 | * <componentDescriptor> subelements. | |
422 | * | |
423 | * | |
424 | * | |
425 | * @param componentDescriptors | |
426 | */ | |
427 | public void setComponentDescriptors(java.util.List componentDescriptors) | |
428 | { | |
429 | 0 | this.componentDescriptors = componentDescriptors; |
430 | 0 | } //-- void setComponentDescriptors(java.util.List) |
431 | ||
432 | /** | |
433 | * Set | |
434 | * | |
435 | * Specifies which dependencies to include in the | |
436 | * assembly. A | |
437 | * dependencySet is specified by providing one or | |
438 | * more of | |
439 | * <dependencySet> subelements. | |
440 | * | |
441 | * | |
442 | * | |
443 | * @param dependencySets | |
444 | */ | |
445 | public void setDependencySets(java.util.List dependencySets) | |
446 | { | |
447 | 0 | this.dependencySets = dependencySets; |
448 | 0 | } //-- void setDependencySets(java.util.List) |
449 | ||
450 | /** | |
451 | * Set | |
452 | * | |
453 | * Specifies which groups of files to include in | |
454 | * the assembly. A | |
455 | * fileSet is specified by providing one or more of | |
456 | * <fileSet> | |
457 | * subelements. | |
458 | * | |
459 | * | |
460 | * | |
461 | * @param fileSets | |
462 | */ | |
463 | public void setFileSets(java.util.List fileSets) | |
464 | { | |
465 | 0 | this.fileSets = fileSets; |
466 | 0 | } //-- void setFileSets(java.util.List) |
467 | ||
468 | /** | |
469 | * Set | |
470 | * | |
471 | * Specifies which single files to include in the | |
472 | * assembly. A file | |
473 | * is specified by providing one or more of | |
474 | * <file> | |
475 | * subelements. | |
476 | * | |
477 | * | |
478 | * | |
479 | * @param files | |
480 | */ | |
481 | public void setFiles(java.util.List files) | |
482 | { | |
483 | 0 | this.files = files; |
484 | 0 | } //-- void setFiles(java.util.List) |
485 | ||
486 | /** | |
487 | * Set | |
488 | * | |
489 | * Specifies the formats of the assembly. Multiple | |
490 | * formats can be | |
491 | * supplied and the Assembly Plugin will generate | |
492 | * an archive for each | |
493 | * desired formats. When deploying your project, | |
494 | * all file formats | |
495 | * specified will also be deployed. A format is | |
496 | * specified by supplying | |
497 | * one of the following values in a <format> | |
498 | * subelement: | |
499 | * <ul> | |
500 | * <li><b>"zip"</b> - Creates a ZIP file | |
501 | * format</li> | |
502 | * <li><b>"gz"</b> - Creates a GZIP format</li> | |
503 | * <li><b>"tar"</b> - Creates a TAR format</li> | |
504 | * <li><b>"tar.gz"</b> - Creates a gzip'd TAR | |
505 | * format</li> | |
506 | * <li><b>"tar.bz2</b> - Creates a bzip'd TAR | |
507 | * format</li> | |
508 | * </ul> | |
509 | * | |
510 | * | |
511 | * | |
512 | * @param formats | |
513 | */ | |
514 | public void setFormats(java.util.List formats) | |
515 | { | |
516 | 0 | this.formats = formats; |
517 | 0 | } //-- void setFormats(java.util.List) |
518 | ||
519 | /** | |
520 | * Set | |
521 | * Sets the id of this assembly. This is a symbolic | |
522 | * name for a | |
523 | * particular assembly of files from this project. | |
524 | * Also, aside from | |
525 | * being used to distinctly name the assembled | |
526 | * package by attaching | |
527 | * its value to the generated archive, the id is | |
528 | * used as your | |
529 | * artifact's classifier when deploying. | |
530 | * | |
531 | * | |
532 | * @param id | |
533 | */ | |
534 | public void setId(String id) | |
535 | { | |
536 | 0 | this.id = id; |
537 | 0 | } //-- void setId(String) |
538 | ||
539 | /** | |
540 | * Set | |
541 | * Includes a base directory in the final archive. | |
542 | * For example, | |
543 | * if you are creating an assembly named | |
544 | * "your-app", setting | |
545 | * includeBaseDirectory to true will create an | |
546 | * archive that | |
547 | * includes this base directory. If this option is | |
548 | * set to false | |
549 | * the archive created will unzip its content to | |
550 | * the current | |
551 | * directory. Default value is true. | |
552 | * | |
553 | * | |
554 | * @param includeBaseDirectory | |
555 | */ | |
556 | public void setIncludeBaseDirectory(boolean includeBaseDirectory) | |
557 | { | |
558 | 0 | this.includeBaseDirectory = includeBaseDirectory; |
559 | 0 | } //-- void setIncludeBaseDirectory(boolean) |
560 | ||
561 | /** | |
562 | * Set | |
563 | * Includes a site directory in the final archive. | |
564 | * The site directory | |
565 | * location of a project is determined by the | |
566 | * siteDirectory parameter | |
567 | * of the Assembly Plugin. Default value is false. | |
568 | * | |
569 | * | |
570 | * @param includeSiteDirectory | |
571 | */ | |
572 | public void setIncludeSiteDirectory(boolean includeSiteDirectory) | |
573 | { | |
574 | 0 | this.includeSiteDirectory = includeSiteDirectory; |
575 | 0 | } //-- void setIncludeSiteDirectory(boolean) |
576 | ||
577 | /** | |
578 | * Set | |
579 | * | |
580 | * Specifies which module files to include in the | |
581 | * assembly. A moduleSet | |
582 | * is specified by providing one or more of | |
583 | * <moduleSet> | |
584 | * subelements. | |
585 | * | |
586 | * | |
587 | * | |
588 | * @param moduleSets | |
589 | */ | |
590 | public void setModuleSets(java.util.List moduleSets) | |
591 | { | |
592 | 0 | this.moduleSets = moduleSets; |
593 | 0 | } //-- void setModuleSets(java.util.List) |
594 | ||
595 | /** | |
596 | * Set | |
597 | * | |
598 | * Specifies which repository files to include in | |
599 | * the assembly. A | |
600 | * repository is specified by providing one or more | |
601 | * of | |
602 | * <repository> subelements. | |
603 | * | |
604 | * | |
605 | * | |
606 | * @param repositories | |
607 | */ | |
608 | public void setRepositories(java.util.List repositories) | |
609 | { | |
610 | 0 | this.repositories = repositories; |
611 | 0 | } //-- void setRepositories(java.util.List) |
612 | ||
613 | ||
614 | 0 | private String modelEncoding = "UTF-8"; |
615 | ||
616 | public void setModelEncoding( String modelEncoding ) | |
617 | { | |
618 | 0 | this.modelEncoding = modelEncoding; |
619 | 0 | } |
620 | ||
621 | public String getModelEncoding() | |
622 | { | |
623 | 0 | return modelEncoding; |
624 | }} |