1 | |
package org.apache.maven.plugin.javadoc; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.commons.lang.ClassUtils; |
23 | |
import org.apache.commons.lang.SystemUtils; |
24 | |
import org.apache.maven.artifact.Artifact; |
25 | |
import org.apache.maven.artifact.factory.ArtifactFactory; |
26 | |
import org.apache.maven.artifact.handler.ArtifactHandler; |
27 | |
import org.apache.maven.artifact.metadata.ArtifactMetadataSource; |
28 | |
import org.apache.maven.artifact.repository.ArtifactRepository; |
29 | |
import org.apache.maven.artifact.resolver.ArtifactNotFoundException; |
30 | |
import org.apache.maven.artifact.resolver.ArtifactResolutionException; |
31 | |
import org.apache.maven.artifact.resolver.ArtifactResolutionResult; |
32 | |
import org.apache.maven.artifact.resolver.ArtifactResolver; |
33 | |
import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException; |
34 | |
import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; |
35 | |
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; |
36 | |
import org.apache.maven.artifact.resolver.filter.IncludesArtifactFilter; |
37 | |
import org.apache.maven.artifact.versioning.ArtifactVersion; |
38 | |
import org.apache.maven.artifact.versioning.DefaultArtifactVersion; |
39 | |
import org.apache.maven.execution.MavenSession; |
40 | |
import org.apache.maven.model.Dependency; |
41 | |
import org.apache.maven.model.Plugin; |
42 | |
import org.apache.maven.model.Resource; |
43 | |
import org.apache.maven.plugin.AbstractMojo; |
44 | |
import org.apache.maven.plugin.MojoExecutionException; |
45 | |
import org.apache.maven.plugin.javadoc.options.BootclasspathArtifact; |
46 | |
import org.apache.maven.plugin.javadoc.options.DocletArtifact; |
47 | |
import org.apache.maven.plugin.javadoc.options.Group; |
48 | |
import org.apache.maven.plugin.javadoc.options.JavadocOptions; |
49 | |
import org.apache.maven.plugin.javadoc.options.JavadocPathArtifact; |
50 | |
import org.apache.maven.plugin.javadoc.options.OfflineLink; |
51 | |
import org.apache.maven.plugin.javadoc.options.ResourcesArtifact; |
52 | |
import org.apache.maven.plugin.javadoc.options.Tag; |
53 | |
import org.apache.maven.plugin.javadoc.options.Taglet; |
54 | |
import org.apache.maven.plugin.javadoc.options.TagletArtifact; |
55 | |
import org.apache.maven.plugin.javadoc.options.io.xpp3.JavadocOptionsXpp3Writer; |
56 | |
import org.apache.maven.plugin.javadoc.resolver.JavadocBundle; |
57 | |
import org.apache.maven.plugin.javadoc.resolver.ResourceResolver; |
58 | |
import org.apache.maven.plugin.javadoc.resolver.SourceResolverConfig; |
59 | |
import org.apache.maven.plugins.annotations.Component; |
60 | |
import org.apache.maven.plugins.annotations.Parameter; |
61 | |
import org.apache.maven.project.MavenProject; |
62 | |
import org.apache.maven.project.MavenProjectBuilder; |
63 | |
import org.apache.maven.project.ProjectBuildingException; |
64 | |
import org.apache.maven.project.artifact.InvalidDependencyVersionException; |
65 | |
import org.apache.maven.reporting.MavenReportException; |
66 | |
import org.apache.maven.settings.Proxy; |
67 | |
import org.apache.maven.settings.Settings; |
68 | |
import org.apache.maven.shared.artifact.filter.PatternExcludesArtifactFilter; |
69 | |
import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter; |
70 | |
import org.apache.maven.shared.invoker.MavenInvocationException; |
71 | |
import org.apache.maven.toolchain.Toolchain; |
72 | |
import org.apache.maven.toolchain.ToolchainManager; |
73 | |
import org.apache.maven.wagon.PathUtils; |
74 | |
import org.codehaus.plexus.archiver.ArchiverException; |
75 | |
import org.codehaus.plexus.archiver.UnArchiver; |
76 | |
import org.codehaus.plexus.archiver.manager.ArchiverManager; |
77 | |
import org.codehaus.plexus.archiver.manager.NoSuchArchiverException; |
78 | |
import org.codehaus.plexus.components.io.fileselectors.IncludeExcludeFileSelector; |
79 | |
import org.codehaus.plexus.util.FileUtils; |
80 | |
import org.codehaus.plexus.util.IOUtil; |
81 | |
import org.codehaus.plexus.util.ReaderFactory; |
82 | |
import org.codehaus.plexus.util.StringUtils; |
83 | |
import org.codehaus.plexus.util.WriterFactory; |
84 | |
import org.codehaus.plexus.util.cli.CommandLineException; |
85 | |
import org.codehaus.plexus.util.cli.CommandLineUtils; |
86 | |
import org.codehaus.plexus.util.cli.Commandline; |
87 | |
import org.codehaus.plexus.util.xml.Xpp3Dom; |
88 | |
|
89 | |
import java.io.File; |
90 | |
import java.io.FileOutputStream; |
91 | |
import java.io.IOException; |
92 | |
import java.io.InputStream; |
93 | |
import java.io.OutputStream; |
94 | |
import java.io.Writer; |
95 | |
import java.net.MalformedURLException; |
96 | |
import java.net.URI; |
97 | |
import java.net.URISyntaxException; |
98 | |
import java.net.URL; |
99 | |
import java.net.URLClassLoader; |
100 | |
import java.util.ArrayList; |
101 | |
import java.util.Arrays; |
102 | |
import java.util.Calendar; |
103 | |
import java.util.Collection; |
104 | |
import java.util.Collections; |
105 | |
import java.util.HashMap; |
106 | |
import java.util.HashSet; |
107 | |
import java.util.LinkedHashSet; |
108 | |
import java.util.LinkedList; |
109 | |
import java.util.List; |
110 | |
import java.util.Locale; |
111 | |
import java.util.Map; |
112 | |
import java.util.Properties; |
113 | |
import java.util.Set; |
114 | |
import java.util.StringTokenizer; |
115 | |
|
116 | |
import static org.apache.maven.plugin.javadoc.JavadocUtil.isEmpty; |
117 | |
import static org.apache.maven.plugin.javadoc.JavadocUtil.isNotEmpty; |
118 | |
import static org.apache.maven.plugin.javadoc.JavadocUtil.toList; |
119 | |
import static org.apache.maven.plugin.javadoc.JavadocUtil.toRelative; |
120 | |
import static org.codehaus.plexus.util.IOUtil.close; |
121 | |
|
122 | |
|
123 | |
|
124 | |
|
125 | |
|
126 | |
|
127 | |
|
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | 74 | public abstract class AbstractJavadocMojo |
133 | |
extends AbstractMojo |
134 | |
{ |
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | |
|
140 | |
|
141 | |
|
142 | |
public static final String JAVADOC_RESOURCES_ATTACHMENT_CLASSIFIER = "javadoc-resources"; |
143 | |
|
144 | |
|
145 | |
|
146 | |
|
147 | |
|
148 | |
|
149 | |
|
150 | |
|
151 | |
public static final String TEST_JAVADOC_RESOURCES_ATTACHMENT_CLASSIFIER = "test-javadoc-resources"; |
152 | |
|
153 | |
|
154 | |
|
155 | |
|
156 | |
|
157 | |
|
158 | |
|
159 | |
|
160 | |
|
161 | |
|
162 | |
|
163 | |
|
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | |
|
170 | |
|
171 | |
|
172 | |
|
173 | |
|
174 | |
|
175 | |
|
176 | |
|
177 | |
|
178 | |
|
179 | |
|
180 | |
|
181 | |
|
182 | |
|
183 | 2 | public static final Properties DEFAULT_JAVA_API_LINKS = new Properties(); |
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | 2 | protected static final String DEBUG_JAVADOC_SCRIPT_NAME = "javadoc." + ( SystemUtils.IS_OS_WINDOWS ? "bat" : "sh" ); |
189 | |
|
190 | |
|
191 | |
|
192 | |
|
193 | |
|
194 | |
protected static final String OPTIONS_FILE_NAME = "options"; |
195 | |
|
196 | |
|
197 | |
|
198 | |
|
199 | |
|
200 | |
protected static final String PACKAGES_FILE_NAME = "packages"; |
201 | |
|
202 | |
|
203 | |
|
204 | |
|
205 | |
|
206 | |
protected static final String ARGFILE_FILE_NAME = "argfile"; |
207 | |
|
208 | |
|
209 | |
|
210 | |
|
211 | |
|
212 | |
protected static final String FILES_FILE_NAME = "files"; |
213 | |
|
214 | |
|
215 | |
|
216 | |
|
217 | 2 | private static final String RESOURCE_DIR = ClassUtils.getPackageName( JavadocReport.class ).replace( '.', '/' ); |
218 | |
|
219 | |
|
220 | |
|
221 | |
|
222 | |
private static final String DEFAULT_CSS_NAME = "stylesheet.css"; |
223 | |
|
224 | |
|
225 | |
|
226 | |
|
227 | 2 | private static final String RESOURCE_CSS_DIR = RESOURCE_DIR + "/css"; |
228 | |
|
229 | |
|
230 | |
|
231 | |
|
232 | |
|
233 | |
|
234 | |
|
235 | |
|
236 | |
private static final float SINCE_JAVADOC_1_4 = 1.4f; |
237 | |
|
238 | |
|
239 | |
|
240 | |
|
241 | |
|
242 | |
|
243 | |
|
244 | |
|
245 | |
private static final float SINCE_JAVADOC_1_4_2 = 1.42f; |
246 | |
|
247 | |
|
248 | |
|
249 | |
|
250 | |
|
251 | |
|
252 | |
|
253 | |
|
254 | |
private static final float SINCE_JAVADOC_1_5 = 1.5f; |
255 | |
|
256 | |
|
257 | |
|
258 | |
|
259 | |
|
260 | |
|
261 | |
|
262 | |
|
263 | |
private static final float SINCE_JAVADOC_1_6 = 1.6f; |
264 | |
|
265 | |
|
266 | |
|
267 | |
|
268 | |
|
269 | |
|
270 | |
|
271 | |
|
272 | |
|
273 | |
|
274 | |
@Component |
275 | |
private ArchiverManager archiverManager; |
276 | |
|
277 | |
|
278 | |
|
279 | |
|
280 | |
@Component |
281 | |
private ArtifactFactory factory; |
282 | |
|
283 | |
|
284 | |
|
285 | |
|
286 | |
|
287 | |
|
288 | |
@Component |
289 | |
private ArtifactMetadataSource artifactMetadataSource; |
290 | |
|
291 | |
|
292 | |
|
293 | |
|
294 | |
@Component |
295 | |
private ArtifactResolver resolver; |
296 | |
|
297 | |
|
298 | |
|
299 | |
|
300 | |
|
301 | |
|
302 | |
@Component |
303 | |
private MavenProjectBuilder mavenProjectBuilder; |
304 | |
|
305 | |
|
306 | |
@Component |
307 | |
private ToolchainManager toolchainManager; |
308 | |
|
309 | |
|
310 | |
|
311 | |
|
312 | |
|
313 | |
|
314 | |
|
315 | |
|
316 | |
|
317 | |
@Component |
318 | |
private MavenSession session; |
319 | |
|
320 | |
|
321 | |
|
322 | |
|
323 | |
|
324 | |
|
325 | |
@Component |
326 | |
private Settings settings; |
327 | |
|
328 | |
|
329 | |
|
330 | |
|
331 | |
@Component |
332 | |
protected MavenProject project; |
333 | |
|
334 | |
|
335 | |
|
336 | |
|
337 | |
@Parameter( defaultValue = "${settings.offline}", required = true, readonly = true ) |
338 | |
private boolean isOffline; |
339 | |
|
340 | |
|
341 | |
|
342 | |
|
343 | |
|
344 | |
|
345 | |
|
346 | |
|
347 | |
|
348 | |
|
349 | |
|
350 | |
@Parameter( defaultValue = "${basedir}/src/main/javadoc" ) |
351 | |
private File javadocDirectory; |
352 | |
|
353 | |
|
354 | |
|
355 | |
|
356 | |
|
357 | |
@Parameter( property = "additionalparam" ) |
358 | |
private String additionalparam; |
359 | |
|
360 | |
|
361 | |
|
362 | |
|
363 | |
|
364 | |
|
365 | |
|
366 | |
|
367 | |
|
368 | |
|
369 | |
|
370 | |
|
371 | |
|
372 | |
|
373 | |
|
374 | |
@Parameter( property = "additionalJOption" ) |
375 | |
private String additionalJOption; |
376 | |
|
377 | |
|
378 | |
|
379 | |
|
380 | |
|
381 | |
|
382 | |
|
383 | |
|
384 | |
|
385 | |
|
386 | |
|
387 | |
@Parameter |
388 | |
private String[] additionalJOptions; |
389 | |
|
390 | |
|
391 | |
|
392 | |
|
393 | |
|
394 | |
|
395 | |
|
396 | |
|
397 | |
|
398 | |
|
399 | |
|
400 | |
|
401 | |
|
402 | |
|
403 | |
|
404 | |
|
405 | |
|
406 | |
|
407 | |
|
408 | |
|
409 | |
|
410 | |
@Parameter( property = "resourcesArtifacts" ) |
411 | |
private ResourcesArtifact[] resourcesArtifacts; |
412 | |
|
413 | |
|
414 | |
|
415 | |
|
416 | |
@Parameter( property = "localRepository" ) |
417 | |
private ArtifactRepository localRepository; |
418 | |
|
419 | |
|
420 | |
|
421 | |
|
422 | |
@Parameter( property = "project.remoteArtifactRepositories" ) |
423 | |
private List<ArtifactRepository> remoteRepositories; |
424 | |
|
425 | |
|
426 | |
|
427 | |
|
428 | |
@Parameter( property = "reactorProjects", readonly = true ) |
429 | |
private List<MavenProject> reactorProjects; |
430 | |
|
431 | |
|
432 | |
|
433 | |
|
434 | |
|
435 | |
|
436 | |
@Parameter( property = "aggregate", defaultValue = "false" ) |
437 | |
protected boolean aggregate; |
438 | |
|
439 | |
|
440 | |
|
441 | |
|
442 | |
|
443 | |
|
444 | |
|
445 | |
|
446 | |
@Parameter( property = "debug", defaultValue = "false" ) |
447 | |
private boolean debug; |
448 | |
|
449 | |
|
450 | |
|
451 | |
|
452 | |
|
453 | |
|
454 | |
|
455 | |
@Parameter( property = "javadocExecutable" ) |
456 | |
private String javadocExecutable; |
457 | |
|
458 | |
|
459 | |
|
460 | |
|
461 | |
|
462 | |
|
463 | |
@Parameter( property = "javadocVersion" ) |
464 | |
private String javadocVersion; |
465 | |
|
466 | |
|
467 | |
|
468 | |
|
469 | 74 | private float fJavadocVersion = 0.0f; |
470 | |
|
471 | |
|
472 | |
|
473 | |
|
474 | |
|
475 | |
|
476 | |
@Parameter( property = "maven.javadoc.skip", defaultValue = "false" ) |
477 | |
protected boolean skip; |
478 | |
|
479 | |
|
480 | |
|
481 | |
|
482 | |
|
483 | |
|
484 | |
@Parameter( property = "maven.javadoc.failOnError", defaultValue = "true" ) |
485 | |
protected boolean failOnError; |
486 | |
|
487 | |
|
488 | |
|
489 | |
|
490 | |
|
491 | |
|
492 | |
|
493 | |
|
494 | |
|
495 | |
|
496 | |
|
497 | |
|
498 | |
|
499 | |
|
500 | |
|
501 | |
|
502 | |
|
503 | |
|
504 | |
|
505 | |
@Parameter( property = "useStandardDocletOptions", defaultValue = "true" ) |
506 | |
protected boolean useStandardDocletOptions; |
507 | |
|
508 | |
|
509 | |
|
510 | |
|
511 | |
|
512 | |
|
513 | |
|
514 | |
|
515 | |
|
516 | |
|
517 | |
|
518 | |
|
519 | |
|
520 | |
|
521 | |
|
522 | |
|
523 | |
|
524 | |
|
525 | |
@Parameter( property = "detectLinks", defaultValue = "false" ) |
526 | |
private boolean detectLinks; |
527 | |
|
528 | |
|
529 | |
|
530 | |
|
531 | |
|
532 | |
|
533 | |
|
534 | |
|
535 | |
|
536 | |
|
537 | |
|
538 | |
|
539 | |
|
540 | |
|
541 | |
|
542 | |
|
543 | |
|
544 | |
@Parameter( property = "detectOfflineLinks", defaultValue = "true" ) |
545 | |
private boolean detectOfflineLinks; |
546 | |
|
547 | |
|
548 | |
|
549 | |
|
550 | |
|
551 | |
|
552 | |
|
553 | |
|
554 | |
|
555 | |
|
556 | |
|
557 | |
|
558 | |
|
559 | |
|
560 | |
|
561 | |
|
562 | |
|
563 | |
|
564 | |
@Parameter( property = "detectJavaApiLink", defaultValue = "true" ) |
565 | |
private boolean detectJavaApiLink; |
566 | |
|
567 | |
|
568 | |
|
569 | |
|
570 | |
|
571 | |
|
572 | |
|
573 | |
|
574 | |
|
575 | |
|
576 | |
|
577 | |
|
578 | |
@Parameter( property = "javaApiLinks" ) |
579 | |
private Properties javaApiLinks; |
580 | |
|
581 | |
|
582 | |
|
583 | |
|
584 | |
|
585 | |
|
586 | |
|
587 | |
@Parameter( property = "validateLinks", defaultValue = "false" ) |
588 | |
private boolean validateLinks; |
589 | |
|
590 | |
|
591 | |
|
592 | |
|
593 | |
|
594 | |
|
595 | |
|
596 | |
|
597 | |
|
598 | |
|
599 | |
|
600 | |
|
601 | |
|
602 | |
|
603 | |
@Parameter( property = "bootclasspath" ) |
604 | |
private String bootclasspath; |
605 | |
|
606 | |
|
607 | |
|
608 | |
|
609 | |
|
610 | |
|
611 | |
|
612 | |
|
613 | |
|
614 | |
|
615 | |
|
616 | |
|
617 | |
|
618 | |
|
619 | |
|
620 | |
|
621 | |
|
622 | |
|
623 | |
|
624 | |
|
625 | |
|
626 | |
|
627 | |
@Parameter( property = "bootclasspathArtifacts" ) |
628 | |
private BootclasspathArtifact[] bootclasspathArtifacts; |
629 | |
|
630 | |
|
631 | |
|
632 | |
|
633 | |
|
634 | |
|
635 | |
|
636 | |
|
637 | |
|
638 | |
@Parameter( property = "breakiterator", defaultValue = "false" ) |
639 | |
private boolean breakiterator; |
640 | |
|
641 | |
|
642 | |
|
643 | |
|
644 | |
|
645 | |
|
646 | |
@Parameter( property = "doclet" ) |
647 | |
private String doclet; |
648 | |
|
649 | |
|
650 | |
|
651 | |
|
652 | |
|
653 | |
|
654 | |
|
655 | |
|
656 | |
|
657 | |
|
658 | |
|
659 | |
|
660 | |
|
661 | |
|
662 | |
|
663 | |
|
664 | |
|
665 | |
|
666 | |
|
667 | |
@Parameter( property = "docletArtifact" ) |
668 | |
private DocletArtifact docletArtifact; |
669 | |
|
670 | |
|
671 | |
|
672 | |
|
673 | |
|
674 | |
|
675 | |
|
676 | |
|
677 | |
|
678 | |
|
679 | |
|
680 | |
|
681 | |
|
682 | |
|
683 | |
|
684 | |
|
685 | |
|
686 | |
|
687 | |
|
688 | |
|
689 | |
|
690 | |
|
691 | |
|
692 | |
@Parameter( property = "docletArtifacts" ) |
693 | |
private DocletArtifact[] docletArtifacts; |
694 | |
|
695 | |
|
696 | |
|
697 | |
|
698 | |
|
699 | |
|
700 | |
|
701 | |
|
702 | |
@Parameter( property = "docletPath" ) |
703 | |
private String docletPath; |
704 | |
|
705 | |
|
706 | |
|
707 | |
|
708 | |
|
709 | |
|
710 | |
|
711 | |
|
712 | |
|
713 | |
|
714 | |
|
715 | |
@Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" ) |
716 | |
private String encoding; |
717 | |
|
718 | |
|
719 | |
|
720 | |
|
721 | |
|
722 | |
|
723 | |
|
724 | |
|
725 | |
|
726 | |
|
727 | |
|
728 | |
|
729 | |
|
730 | |
|
731 | |
|
732 | |
@Parameter( property = "excludePackageNames" ) |
733 | |
private String excludePackageNames; |
734 | |
|
735 | |
|
736 | |
|
737 | |
|
738 | |
|
739 | |
|
740 | |
|
741 | |
@Parameter( property = "extdirs" ) |
742 | |
private String extdirs; |
743 | |
|
744 | |
|
745 | |
|
746 | |
|
747 | |
|
748 | |
|
749 | |
@Parameter( property = "locale" ) |
750 | |
private String locale; |
751 | |
|
752 | |
|
753 | |
|
754 | |
|
755 | |
|
756 | |
|
757 | |
|
758 | |
|
759 | |
@Parameter( property = "maxmemory" ) |
760 | |
private String maxmemory; |
761 | |
|
762 | |
|
763 | |
|
764 | |
|
765 | |
|
766 | |
|
767 | |
|
768 | |
|
769 | |
@Parameter( property = "minmemory" ) |
770 | |
private String minmemory; |
771 | |
|
772 | |
|
773 | |
|
774 | |
|
775 | |
|
776 | |
|
777 | |
|
778 | |
|
779 | |
@Parameter( property = "old", defaultValue = "false" ) |
780 | |
private boolean old; |
781 | |
|
782 | |
|
783 | |
|
784 | |
|
785 | |
|
786 | |
|
787 | |
|
788 | |
|
789 | |
|
790 | |
|
791 | |
@Parameter( property = "overview", defaultValue = "${basedir}/src/main/javadoc/overview.html" ) |
792 | |
private File overview; |
793 | |
|
794 | |
|
795 | |
|
796 | |
|
797 | |
|
798 | |
|
799 | |
|
800 | |
|
801 | |
|
802 | |
@Parameter( property = "proxyHost" ) |
803 | |
private String proxyHost; |
804 | |
|
805 | |
|
806 | |
|
807 | |
|
808 | |
|
809 | |
|
810 | |
|
811 | |
|
812 | |
|
813 | |
@Parameter( property = "proxyPort" ) |
814 | |
private int proxyPort; |
815 | |
|
816 | |
|
817 | |
|
818 | |
|
819 | |
|
820 | |
|
821 | |
|
822 | |
|
823 | |
|
824 | |
|
825 | |
|
826 | |
|
827 | |
|
828 | |
@Parameter( property = "quiet", defaultValue = "false" ) |
829 | |
private boolean quiet; |
830 | |
|
831 | |
|
832 | |
|
833 | |
|
834 | |
|
835 | |
|
836 | |
|
837 | |
|
838 | |
|
839 | |
|
840 | |
|
841 | |
|
842 | |
|
843 | |
|
844 | |
|
845 | |
|
846 | |
@Parameter( property = "show", defaultValue = "protected" ) |
847 | |
private String show; |
848 | |
|
849 | |
|
850 | |
|
851 | |
|
852 | |
|
853 | |
|
854 | |
|
855 | |
|
856 | |
@Parameter( property = "source" ) |
857 | |
private String source; |
858 | |
|
859 | |
|
860 | |
|
861 | |
|
862 | |
|
863 | |
|
864 | |
|
865 | |
@Parameter( property = "sourcepath" ) |
866 | |
private String sourcepath; |
867 | |
|
868 | |
|
869 | |
|
870 | |
|
871 | |
|
872 | |
|
873 | |
|
874 | |
|
875 | |
|
876 | |
@Parameter( property = "subpackages" ) |
877 | |
private String subpackages; |
878 | |
|
879 | |
|
880 | |
|
881 | |
|
882 | |
|
883 | |
|
884 | |
|
885 | |
@Parameter( property = "verbose", defaultValue = "false" ) |
886 | |
private boolean verbose; |
887 | |
|
888 | |
|
889 | |
|
890 | |
|
891 | |
|
892 | |
|
893 | |
|
894 | |
|
895 | |
|
896 | |
|
897 | |
|
898 | |
@Parameter( property = "author", defaultValue = "true" ) |
899 | |
private boolean author; |
900 | |
|
901 | |
|
902 | |
|
903 | |
|
904 | |
|
905 | |
|
906 | |
|
907 | |
|
908 | |
|
909 | |
@Parameter( property = "bottom", |
910 | |
defaultValue = "Copyright © {inceptionYear}-{currentYear} {organizationName}. All Rights Reserved." ) |
911 | |
private String bottom; |
912 | |
|
913 | |
|
914 | |
|
915 | |
|
916 | |
|
917 | |
|
918 | |
|
919 | |
|
920 | |
@Parameter( property = "charset" ) |
921 | |
private String charset; |
922 | |
|
923 | |
|
924 | |
|
925 | |
|
926 | |
|
927 | |
|
928 | |
|
929 | |
@Parameter( property = "docencoding", defaultValue = "${project.reporting.outputEncoding}" ) |
930 | |
private String docencoding; |
931 | |
|
932 | |
|
933 | |
|
934 | |
|
935 | |
|
936 | |
|
937 | |
|
938 | |
|
939 | |
|
940 | |
|
941 | |
|
942 | |
|
943 | |
|
944 | |
|
945 | |
|
946 | |
|
947 | |
|
948 | |
@Parameter( property = "docfilessubdirs", defaultValue = "false" ) |
949 | |
private boolean docfilessubdirs; |
950 | |
|
951 | |
|
952 | |
|
953 | |
|
954 | |
|
955 | |
|
956 | |
|
957 | |
@Parameter( property = "doctitle", defaultValue = "${project.name} ${project.version} API" ) |
958 | |
private String doctitle; |
959 | |
|
960 | |
|
961 | |
|
962 | |
|
963 | |
|
964 | |
|
965 | |
|
966 | |
|
967 | |
|
968 | |
|
969 | |
|
970 | |
|
971 | |
@Parameter( property = "excludedocfilessubdir" ) |
972 | |
private String excludedocfilessubdir; |
973 | |
|
974 | |
|
975 | |
|
976 | |
|
977 | |
|
978 | |
|
979 | |
@Parameter( property = "footer" ) |
980 | |
private String footer; |
981 | |
|
982 | |
|
983 | |
|
984 | |
|
985 | |
|
986 | |
|
987 | |
|
988 | |
|
989 | |
|
990 | |
|
991 | |
|
992 | |
|
993 | |
|
994 | |
|
995 | |
|
996 | |
|
997 | |
|
998 | |
|
999 | |
|
1000 | |
|
1001 | |
|
1002 | |
|
1003 | |
|
1004 | |
|
1005 | |
|
1006 | |
|
1007 | |
|
1008 | |
|
1009 | |
|
1010 | |
|
1011 | |
|
1012 | |
|
1013 | |
|
1014 | |
@Parameter( property = "groups" ) |
1015 | |
private Group[] groups; |
1016 | |
|
1017 | |
|
1018 | |
|
1019 | |
|
1020 | |
|
1021 | |
|
1022 | |
@Parameter( property = "header" ) |
1023 | |
private String header; |
1024 | |
|
1025 | |
|
1026 | |
|
1027 | |
|
1028 | |
|
1029 | |
|
1030 | |
|
1031 | |
|
1032 | |
|
1033 | |
|
1034 | |
|
1035 | |
|
1036 | |
|
1037 | |
|
1038 | |
|
1039 | |
|
1040 | |
|
1041 | |
|
1042 | |
|
1043 | |
|
1044 | |
|
1045 | |
|
1046 | |
|
1047 | |
|
1048 | |
|
1049 | |
|
1050 | |
|
1051 | |
|
1052 | |
|
1053 | |
|
1054 | |
|
1055 | |
|
1056 | |
|
1057 | |
|
1058 | |
|
1059 | |
|
1060 | |
|
1061 | |
|
1062 | |
|
1063 | |
|
1064 | |
|
1065 | |
|
1066 | |
|
1067 | |
@Parameter( property = "helpfile" ) |
1068 | |
private String helpfile; |
1069 | |
|
1070 | |
|
1071 | |
|
1072 | |
|
1073 | |
|
1074 | |
|
1075 | |
|
1076 | |
|
1077 | |
|
1078 | |
|
1079 | |
|
1080 | |
|
1081 | |
|
1082 | |
|
1083 | |
|
1084 | |
@Parameter( property = "keywords", defaultValue = "false" ) |
1085 | |
private boolean keywords; |
1086 | |
|
1087 | |
|
1088 | |
|
1089 | |
|
1090 | |
|
1091 | |
|
1092 | |
|
1093 | |
|
1094 | |
|
1095 | |
|
1096 | |
|
1097 | |
|
1098 | |
|
1099 | |
|
1100 | |
|
1101 | |
|
1102 | |
|
1103 | |
|
1104 | |
|
1105 | |
|
1106 | |
|
1107 | |
|
1108 | |
|
1109 | |
|
1110 | |
@Parameter( property = "links" ) |
1111 | |
protected ArrayList<String> links; |
1112 | |
|
1113 | |
|
1114 | |
|
1115 | |
|
1116 | |
|
1117 | |
|
1118 | |
|
1119 | |
|
1120 | |
|
1121 | |
|
1122 | |
@Parameter( property = "linksource", defaultValue = "false" ) |
1123 | |
private boolean linksource; |
1124 | |
|
1125 | |
|
1126 | |
|
1127 | |
|
1128 | |
|
1129 | |
|
1130 | |
|
1131 | |
|
1132 | |
|
1133 | |
@Parameter( property = "nocomment", defaultValue = "false" ) |
1134 | |
private boolean nocomment; |
1135 | |
|
1136 | |
|
1137 | |
|
1138 | |
|
1139 | |
|
1140 | |
|
1141 | |
|
1142 | |
@Parameter( property = "nodeprecated", defaultValue = "false" ) |
1143 | |
private boolean nodeprecated; |
1144 | |
|
1145 | |
|
1146 | |
|
1147 | |
|
1148 | |
|
1149 | |
|
1150 | |
|
1151 | |
|
1152 | |
|
1153 | |
@Parameter( property = "nodeprecatedlist", defaultValue = "false" ) |
1154 | |
private boolean nodeprecatedlist; |
1155 | |
|
1156 | |
|
1157 | |
|
1158 | |
|
1159 | |
|
1160 | |
|
1161 | |
|
1162 | |
|
1163 | |
|
1164 | |
@Parameter( property = "nohelp", defaultValue = "false" ) |
1165 | |
private boolean nohelp; |
1166 | |
|
1167 | |
|
1168 | |
|
1169 | |
|
1170 | |
|
1171 | |
|
1172 | |
|
1173 | |
|
1174 | |
|
1175 | |
@Parameter( property = "noindex", defaultValue = "false" ) |
1176 | |
private boolean noindex; |
1177 | |
|
1178 | |
|
1179 | |
|
1180 | |
|
1181 | |
|
1182 | |
|
1183 | |
|
1184 | |
@Parameter( property = "nonavbar", defaultValue = "false" ) |
1185 | |
private boolean nonavbar; |
1186 | |
|
1187 | |
|
1188 | |
|
1189 | |
|
1190 | |
|
1191 | |
|
1192 | |
|
1193 | |
|
1194 | |
|
1195 | |
|
1196 | |
|
1197 | |
@Parameter( property = "nooverview", defaultValue = "false" ) |
1198 | |
private boolean nooverview; |
1199 | |
|
1200 | |
|
1201 | |
|
1202 | |
|
1203 | |
|
1204 | |
|
1205 | |
|
1206 | |
|
1207 | |
|
1208 | |
|
1209 | |
|
1210 | |
|
1211 | |
|
1212 | |
@Parameter( property = "noqualifier" ) |
1213 | |
private String noqualifier; |
1214 | |
|
1215 | |
|
1216 | |
|
1217 | |
|
1218 | |
|
1219 | |
|
1220 | |
|
1221 | |
@Parameter( property = "nosince", defaultValue = "false" ) |
1222 | |
private boolean nosince; |
1223 | |
|
1224 | |
|
1225 | |
|
1226 | |
|
1227 | |
|
1228 | |
|
1229 | |
|
1230 | |
|
1231 | |
|
1232 | |
|
1233 | |
|
1234 | |
|
1235 | |
@Parameter( property = "notimestamp", defaultValue = "false" ) |
1236 | |
private boolean notimestamp; |
1237 | |
|
1238 | |
|
1239 | |
|
1240 | |
|
1241 | |
|
1242 | |
|
1243 | |
|
1244 | |
@Parameter( property = "notree", defaultValue = "false" ) |
1245 | |
private boolean notree; |
1246 | |
|
1247 | |
|
1248 | |
|
1249 | |
|
1250 | |
|
1251 | |
|
1252 | |
|
1253 | |
|
1254 | |
|
1255 | |
|
1256 | |
|
1257 | |
|
1258 | |
|
1259 | |
|
1260 | |
|
1261 | |
|
1262 | |
|
1263 | |
|
1264 | |
|
1265 | |
|
1266 | |
|
1267 | |
|
1268 | |
|
1269 | |
@Parameter( property = "offlineLinks" ) |
1270 | |
private OfflineLink[] offlineLinks; |
1271 | |
|
1272 | |
|
1273 | |
|
1274 | |
|
1275 | |
|
1276 | |
|
1277 | |
|
1278 | |
@Parameter( property = "destDir", alias = "destDir", defaultValue = "${project.build.directory}/apidocs", |
1279 | |
required = true ) |
1280 | |
protected File outputDirectory; |
1281 | |
|
1282 | |
|
1283 | |
|
1284 | |
|
1285 | |
|
1286 | |
|
1287 | |
|
1288 | |
|
1289 | |
|
1290 | |
@Parameter( property = "packagesheader" ) |
1291 | |
private String packagesheader; |
1292 | |
|
1293 | |
|
1294 | |
|
1295 | |
|
1296 | |
|
1297 | |
|
1298 | |
|
1299 | |
@Parameter( property = "serialwarn", defaultValue = "false" ) |
1300 | |
private boolean serialwarn; |
1301 | |
|
1302 | |
|
1303 | |
|
1304 | |
|
1305 | |
|
1306 | |
|
1307 | |
|
1308 | |
|
1309 | |
|
1310 | |
|
1311 | |
|
1312 | |
|
1313 | |
|
1314 | |
|
1315 | |
|
1316 | |
@Parameter( property = "sourcetab", alias = "linksourcetab" ) |
1317 | |
private int sourcetab; |
1318 | |
|
1319 | |
|
1320 | |
|
1321 | |
|
1322 | |
|
1323 | |
|
1324 | |
|
1325 | |
|
1326 | |
|
1327 | |
|
1328 | |
@Parameter( property = "splitindex", defaultValue = "false" ) |
1329 | |
private boolean splitindex; |
1330 | |
|
1331 | |
|
1332 | |
|
1333 | |
|
1334 | |
|
1335 | |
|
1336 | |
|
1337 | |
|
1338 | |
@Parameter( property = "stylesheet", defaultValue = "java" ) |
1339 | |
private String stylesheet; |
1340 | |
|
1341 | |
|
1342 | |
|
1343 | |
|
1344 | |
|
1345 | |
|
1346 | |
|
1347 | |
|
1348 | |
|
1349 | |
|
1350 | |
|
1351 | |
|
1352 | |
|
1353 | |
|
1354 | |
|
1355 | |
|
1356 | |
|
1357 | |
|
1358 | |
|
1359 | |
|
1360 | |
|
1361 | |
|
1362 | |
|
1363 | |
|
1364 | |
|
1365 | |
|
1366 | |
|
1367 | |
|
1368 | |
|
1369 | |
|
1370 | |
|
1371 | |
|
1372 | |
|
1373 | |
|
1374 | |
|
1375 | |
|
1376 | |
|
1377 | |
|
1378 | |
|
1379 | |
|
1380 | |
|
1381 | |
@Parameter( property = "stylesheetfile" ) |
1382 | |
private String stylesheetfile; |
1383 | |
|
1384 | |
|
1385 | |
|
1386 | |
|
1387 | |
|
1388 | |
|
1389 | |
|
1390 | |
|
1391 | |
@Parameter( property = "taglet" ) |
1392 | |
private String taglet; |
1393 | |
|
1394 | |
|
1395 | |
|
1396 | |
|
1397 | |
|
1398 | |
|
1399 | |
|
1400 | |
|
1401 | |
|
1402 | |
|
1403 | |
|
1404 | |
|
1405 | |
|
1406 | |
|
1407 | |
|
1408 | |
|
1409 | |
|
1410 | |
|
1411 | |
|
1412 | |
|
1413 | |
|
1414 | |
|
1415 | |
|
1416 | |
|
1417 | |
|
1418 | |
|
1419 | |
|
1420 | |
|
1421 | |
|
1422 | |
@Parameter( property = "tagletArtifact" ) |
1423 | |
private TagletArtifact tagletArtifact; |
1424 | |
|
1425 | |
|
1426 | |
|
1427 | |
|
1428 | |
|
1429 | |
|
1430 | |
|
1431 | |
|
1432 | |
|
1433 | |
|
1434 | |
|
1435 | |
|
1436 | |
|
1437 | |
|
1438 | |
|
1439 | |
|
1440 | |
|
1441 | |
|
1442 | |
|
1443 | |
|
1444 | |
|
1445 | |
|
1446 | |
|
1447 | |
|
1448 | |
|
1449 | |
|
1450 | |
@Parameter( property = "tagletArtifacts" ) |
1451 | |
private TagletArtifact[] tagletArtifacts; |
1452 | |
|
1453 | |
|
1454 | |
|
1455 | |
|
1456 | |
|
1457 | |
|
1458 | |
|
1459 | |
|
1460 | |
|
1461 | |
@Parameter( property = "tagletpath" ) |
1462 | |
private String tagletpath; |
1463 | |
|
1464 | |
|
1465 | |
|
1466 | |
|
1467 | |
|
1468 | |
|
1469 | |
|
1470 | |
|
1471 | |
|
1472 | |
|
1473 | |
|
1474 | |
|
1475 | |
|
1476 | |
|
1477 | |
|
1478 | |
|
1479 | |
|
1480 | |
|
1481 | |
|
1482 | |
|
1483 | |
|
1484 | |
|
1485 | |
|
1486 | |
|
1487 | |
|
1488 | |
|
1489 | |
|
1490 | |
|
1491 | |
@Parameter( property = "taglets" ) |
1492 | |
private Taglet[] taglets; |
1493 | |
|
1494 | |
|
1495 | |
|
1496 | |
|
1497 | |
|
1498 | |
|
1499 | |
|
1500 | |
|
1501 | |
|
1502 | |
|
1503 | |
|
1504 | |
|
1505 | |
|
1506 | |
|
1507 | |
|
1508 | |
|
1509 | |
|
1510 | |
|
1511 | |
|
1512 | |
|
1513 | |
|
1514 | |
|
1515 | |
|
1516 | |
|
1517 | |
|
1518 | |
|
1519 | |
|
1520 | |
|
1521 | |
|
1522 | |
|
1523 | |
|
1524 | |
|
1525 | |
@Parameter( property = "tags" ) |
1526 | |
private Tag[] tags; |
1527 | |
|
1528 | |
|
1529 | |
|
1530 | |
|
1531 | |
|
1532 | |
|
1533 | |
|
1534 | |
|
1535 | |
|
1536 | |
|
1537 | |
@Parameter( property = "top" ) |
1538 | |
private String top; |
1539 | |
|
1540 | |
|
1541 | |
|
1542 | |
|
1543 | |
|
1544 | |
|
1545 | |
|
1546 | |
@Parameter( property = "use", defaultValue = "true" ) |
1547 | |
private boolean use; |
1548 | |
|
1549 | |
|
1550 | |
|
1551 | |
|
1552 | |
|
1553 | |
|
1554 | |
|
1555 | |
@Parameter( property = "version", defaultValue = "true" ) |
1556 | |
private boolean version; |
1557 | |
|
1558 | |
|
1559 | |
|
1560 | |
|
1561 | |
|
1562 | |
|
1563 | |
|
1564 | |
@Parameter( property = "windowtitle", defaultValue = "${project.name} ${project.version} API" ) |
1565 | |
private String windowtitle; |
1566 | |
|
1567 | |
|
1568 | |
|
1569 | |
|
1570 | |
|
1571 | |
|
1572 | |
|
1573 | |
@Parameter( defaultValue = "false" ) |
1574 | |
private boolean includeDependencySources; |
1575 | |
|
1576 | |
|
1577 | |
|
1578 | |
|
1579 | |
|
1580 | |
|
1581 | |
|
1582 | |
@Parameter( defaultValue = "${project.build.directory}/distro-javadoc-sources" ) |
1583 | |
private File sourceDependencyCacheDir; |
1584 | |
|
1585 | |
|
1586 | |
|
1587 | |
|
1588 | |
|
1589 | |
|
1590 | |
|
1591 | |
|
1592 | |
@Parameter( defaultValue = "false" ) |
1593 | |
private boolean includeTransitiveDependencySources; |
1594 | |
|
1595 | |
|
1596 | |
|
1597 | |
|
1598 | |
|
1599 | |
|
1600 | |
|
1601 | |
@Parameter |
1602 | |
private List<String> dependencySourceIncludes; |
1603 | |
|
1604 | |
|
1605 | |
|
1606 | |
|
1607 | |
|
1608 | |
|
1609 | |
|
1610 | |
@Parameter |
1611 | |
private List<String> dependencySourceExcludes; |
1612 | |
|
1613 | |
|
1614 | |
|
1615 | |
|
1616 | |
|
1617 | |
|
1618 | |
|
1619 | |
@Parameter( defaultValue = "${project.build.directory}/javadoc-bundle-options", readonly = true ) |
1620 | |
private File javadocOptionsDir; |
1621 | |
|
1622 | |
|
1623 | |
|
1624 | |
|
1625 | |
|
1626 | |
|
1627 | |
|
1628 | |
private transient List<JavadocBundle> dependencyJavadocBundles; |
1629 | |
|
1630 | |
|
1631 | |
|
1632 | |
|
1633 | |
|
1634 | |
|
1635 | |
|
1636 | |
|
1637 | |
|
1638 | |
|
1639 | |
|
1640 | |
|
1641 | |
|
1642 | |
|
1643 | |
|
1644 | |
|
1645 | |
@Parameter |
1646 | |
private List<AdditionalDependency> additionalDependencies; |
1647 | |
|
1648 | |
|
1649 | |
|
1650 | |
|
1651 | |
|
1652 | |
@Parameter |
1653 | |
private List<String> sourceFileIncludes; |
1654 | |
|
1655 | |
|
1656 | |
|
1657 | |
|
1658 | |
|
1659 | |
@Parameter |
1660 | |
private List<String> sourceFileExcludes; |
1661 | |
|
1662 | |
|
1663 | |
|
1664 | |
|
1665 | |
|
1666 | |
static |
1667 | |
{ |
1668 | 2 | DEFAULT_JAVA_API_LINKS.put( "api_1.3", "http://docs.oracle.com/javase/1.3/docs/api/" ); |
1669 | 2 | DEFAULT_JAVA_API_LINKS.put( "api_1.4", "http://docs.oracle.com/javase/1.4.2/docs/api/" ); |
1670 | 2 | DEFAULT_JAVA_API_LINKS.put( "api_1.5", "http://docs.oracle.com/javase/1.5.0/docs/api/" ); |
1671 | 2 | DEFAULT_JAVA_API_LINKS.put( "api_1.6", "http://docs.oracle.com/javase/6/docs/api/" ); |
1672 | 2 | DEFAULT_JAVA_API_LINKS.put( "api_1.7", "http://docs.oracle.com/javase/7/docs/api/" ); |
1673 | 2 | } |
1674 | |
|
1675 | |
|
1676 | |
|
1677 | |
|
1678 | |
|
1679 | |
|
1680 | |
|
1681 | |
|
1682 | |
|
1683 | |
|
1684 | |
|
1685 | |
|
1686 | |
protected boolean isAggregator() |
1687 | |
{ |
1688 | 12 | return false; |
1689 | |
} |
1690 | |
|
1691 | |
|
1692 | |
|
1693 | |
|
1694 | |
protected String getOutputDirectory() |
1695 | |
{ |
1696 | 94 | return outputDirectory.getAbsoluteFile().toString(); |
1697 | |
} |
1698 | |
|
1699 | |
protected MavenProject getProject() |
1700 | |
{ |
1701 | 120 | return project; |
1702 | |
} |
1703 | |
|
1704 | |
|
1705 | |
|
1706 | |
|
1707 | |
|
1708 | |
|
1709 | |
protected List<String> getProjectBuildOutputDirs( MavenProject p ) |
1710 | |
{ |
1711 | 88 | if ( StringUtils.isEmpty( p.getBuild().getOutputDirectory() ) ) |
1712 | |
{ |
1713 | 88 | return Collections.emptyList(); |
1714 | |
} |
1715 | |
|
1716 | 0 | return Collections.singletonList( p.getBuild().getOutputDirectory() ); |
1717 | |
} |
1718 | |
|
1719 | |
|
1720 | |
|
1721 | |
|
1722 | |
|
1723 | |
protected List<String> getProjectSourceRoots( MavenProject p ) |
1724 | |
{ |
1725 | 90 | if ( "pom".equals( p.getPackaging().toLowerCase() ) ) |
1726 | |
{ |
1727 | 2 | return Collections.emptyList(); |
1728 | |
} |
1729 | |
|
1730 | 88 | return ( p.getCompileSourceRoots() == null |
1731 | |
? Collections.<String>emptyList() |
1732 | |
: new LinkedList<String>( p.getCompileSourceRoots() ) ); |
1733 | |
} |
1734 | |
|
1735 | |
|
1736 | |
|
1737 | |
|
1738 | |
|
1739 | |
protected List<String> getExecutionProjectSourceRoots( MavenProject p ) |
1740 | |
{ |
1741 | 12 | if ( "pom".equals( p.getExecutionProject().getPackaging().toLowerCase() ) ) |
1742 | |
{ |
1743 | 0 | return Collections.emptyList(); |
1744 | |
} |
1745 | |
|
1746 | 12 | return ( p.getExecutionProject().getCompileSourceRoots() == null |
1747 | |
? Collections.<String>emptyList() |
1748 | |
: new LinkedList<String>( p.getExecutionProject().getCompileSourceRoots() ) ); |
1749 | |
} |
1750 | |
|
1751 | |
|
1752 | |
|
1753 | |
|
1754 | |
|
1755 | |
protected List<Artifact> getProjectArtifacts( MavenProject p ) |
1756 | |
{ |
1757 | 80 | return ( p.getCompileArtifacts() == null |
1758 | |
? Collections.<Artifact>emptyList() |
1759 | |
: new LinkedList<Artifact>( p.getCompileArtifacts() ) ); |
1760 | |
} |
1761 | |
|
1762 | |
|
1763 | |
|
1764 | |
|
1765 | |
protected File getJavadocDirectory() |
1766 | |
{ |
1767 | 284 | return javadocDirectory; |
1768 | |
} |
1769 | |
|
1770 | |
|
1771 | |
|
1772 | |
|
1773 | |
protected String getDoctitle() |
1774 | |
{ |
1775 | 68 | return doctitle; |
1776 | |
} |
1777 | |
|
1778 | |
|
1779 | |
|
1780 | |
|
1781 | |
protected File getOverview() |
1782 | |
{ |
1783 | 150 | return overview; |
1784 | |
} |
1785 | |
|
1786 | |
|
1787 | |
|
1788 | |
|
1789 | |
protected String getWindowtitle() |
1790 | |
{ |
1791 | 68 | return windowtitle; |
1792 | |
} |
1793 | |
|
1794 | |
|
1795 | |
|
1796 | |
|
1797 | |
private String getCharset() |
1798 | |
{ |
1799 | 224 | return ( StringUtils.isEmpty( charset ) ) ? getDocencoding() : charset; |
1800 | |
} |
1801 | |
|
1802 | |
|
1803 | |
|
1804 | |
|
1805 | |
private String getDocencoding() |
1806 | |
{ |
1807 | 446 | return ( StringUtils.isEmpty( docencoding ) ) ? ReaderFactory.UTF_8 : docencoding; |
1808 | |
} |
1809 | |
|
1810 | |
|
1811 | |
|
1812 | |
|
1813 | |
private String getEncoding() |
1814 | |
{ |
1815 | 256 | return ( StringUtils.isEmpty( encoding ) ) ? ReaderFactory.FILE_ENCODING : encoding; |
1816 | |
} |
1817 | |
|
1818 | |
|
1819 | |
|
1820 | |
|
1821 | |
|
1822 | |
|
1823 | |
|
1824 | |
|
1825 | |
protected void executeReport( Locale unusedLocale ) |
1826 | |
throws MavenReportException |
1827 | |
{ |
1828 | 88 | if ( skip ) |
1829 | |
{ |
1830 | 0 | getLog().info( "Skipping javadoc generation" ); |
1831 | 0 | return; |
1832 | |
} |
1833 | |
|
1834 | 88 | if ( isAggregator() && !project.isExecutionRoot() ) |
1835 | |
{ |
1836 | 0 | return; |
1837 | |
} |
1838 | |
|
1839 | 88 | if ( getLog().isDebugEnabled() ) |
1840 | |
{ |
1841 | 0 | this.debug = true; |
1842 | |
} |
1843 | |
|
1844 | |
|
1845 | |
|
1846 | |
try |
1847 | |
{ |
1848 | 88 | buildJavadocOptions(); |
1849 | |
} |
1850 | 0 | catch ( IOException e ) |
1851 | |
{ |
1852 | 0 | throw new MavenReportException( "Failed to generate javadoc options file: " + e.getMessage(), e ); |
1853 | 88 | } |
1854 | |
|
1855 | 88 | List<String> sourcePaths = getSourcePaths(); |
1856 | 88 | List<String> files = getFiles( sourcePaths ); |
1857 | 88 | if ( !canGenerateReport( files ) ) |
1858 | |
{ |
1859 | 2 | return; |
1860 | |
} |
1861 | |
|
1862 | 86 | List<String> packageNames = getPackageNames( sourcePaths, files ); |
1863 | 86 | List<String> filesWithUnnamedPackages = getFilesWithUnnamedPackages( sourcePaths, files ); |
1864 | |
|
1865 | |
|
1866 | |
|
1867 | |
|
1868 | |
|
1869 | |
String jExecutable; |
1870 | |
try |
1871 | |
{ |
1872 | 86 | jExecutable = getJavadocExecutable(); |
1873 | |
} |
1874 | 0 | catch ( IOException e ) |
1875 | |
{ |
1876 | 0 | throw new MavenReportException( "Unable to find javadoc command: " + e.getMessage(), e ); |
1877 | 86 | } |
1878 | 86 | setFJavadocVersion( new File( jExecutable ) ); |
1879 | |
|
1880 | |
|
1881 | |
|
1882 | |
|
1883 | |
|
1884 | 86 | File javadocOutputDirectory = new File( getOutputDirectory() ); |
1885 | 86 | if ( javadocOutputDirectory.exists() && !javadocOutputDirectory.isDirectory() ) |
1886 | |
{ |
1887 | 0 | throw new MavenReportException( "IOException: " + getOutputDirectory() + " is not a directory." ); |
1888 | |
} |
1889 | 86 | if ( javadocOutputDirectory.exists() && !javadocOutputDirectory.canWrite() ) |
1890 | |
{ |
1891 | 0 | throw new MavenReportException( "IOException: " + getOutputDirectory() + " is not writable." ); |
1892 | |
} |
1893 | 86 | javadocOutputDirectory.mkdirs(); |
1894 | |
|
1895 | |
|
1896 | |
|
1897 | |
|
1898 | |
|
1899 | 86 | copyAllResources( javadocOutputDirectory ); |
1900 | |
|
1901 | |
|
1902 | |
|
1903 | |
|
1904 | |
|
1905 | 86 | Commandline cmd = new Commandline(); |
1906 | 86 | cmd.getShell().setQuotedArgumentsEnabled( false ); |
1907 | 86 | cmd.setWorkingDirectory( javadocOutputDirectory.getAbsolutePath() ); |
1908 | 86 | cmd.setExecutable( jExecutable ); |
1909 | |
|
1910 | |
|
1911 | |
|
1912 | |
|
1913 | |
|
1914 | 86 | addMemoryArg( cmd, "-Xmx", this.maxmemory ); |
1915 | 86 | addMemoryArg( cmd, "-Xms", this.minmemory ); |
1916 | 86 | addProxyArg( cmd ); |
1917 | |
|
1918 | 86 | if ( StringUtils.isNotEmpty( additionalJOption ) ) |
1919 | |
{ |
1920 | 0 | cmd.createArg().setValue( additionalJOption ); |
1921 | |
} |
1922 | |
|
1923 | 86 | if ( additionalJOptions != null && additionalJOptions.length != 0 ) |
1924 | |
{ |
1925 | 0 | for ( String jo : additionalJOptions ) |
1926 | |
{ |
1927 | 0 | cmd.createArg().setValue( jo ); |
1928 | |
} |
1929 | |
} |
1930 | |
|
1931 | 86 | List<String> arguments = new ArrayList<String>(); |
1932 | |
|
1933 | |
|
1934 | |
|
1935 | |
|
1936 | |
|
1937 | 86 | addJavadocOptions( arguments, sourcePaths ); |
1938 | |
|
1939 | |
|
1940 | |
|
1941 | |
|
1942 | |
|
1943 | 82 | if ( StringUtils.isEmpty( doclet ) || useStandardDocletOptions ) |
1944 | |
{ |
1945 | 78 | addStandardDocletOptions( javadocOutputDirectory, arguments ); |
1946 | |
} |
1947 | |
|
1948 | |
|
1949 | |
|
1950 | |
|
1951 | |
|
1952 | 74 | if ( arguments.size() > 0 ) |
1953 | |
{ |
1954 | 74 | addCommandLineOptions( cmd, arguments, javadocOutputDirectory ); |
1955 | |
} |
1956 | |
|
1957 | |
|
1958 | |
|
1959 | |
|
1960 | |
|
1961 | 74 | if ( !packageNames.isEmpty() ) |
1962 | |
{ |
1963 | 50 | addCommandLinePackages( cmd, javadocOutputDirectory, packageNames ); |
1964 | |
|
1965 | |
|
1966 | |
|
1967 | |
|
1968 | |
|
1969 | 50 | if ( !filesWithUnnamedPackages.isEmpty() ) |
1970 | |
{ |
1971 | 0 | addCommandLineArgFile( cmd, javadocOutputDirectory, filesWithUnnamedPackages ); |
1972 | |
} |
1973 | |
} |
1974 | |
else |
1975 | |
{ |
1976 | |
|
1977 | |
|
1978 | |
|
1979 | |
|
1980 | 24 | if ( !files.isEmpty() ) |
1981 | |
{ |
1982 | 22 | addCommandLineArgFile( cmd, javadocOutputDirectory, files ); |
1983 | |
} |
1984 | |
} |
1985 | |
|
1986 | |
|
1987 | |
|
1988 | |
|
1989 | |
|
1990 | 74 | executeJavadocCommandLine( cmd, javadocOutputDirectory ); |
1991 | |
|
1992 | |
|
1993 | |
|
1994 | |
|
1995 | 74 | if ( !debug ) |
1996 | |
{ |
1997 | 0 | for ( int i = 0; i < cmd.getArguments().length; i++ ) |
1998 | |
{ |
1999 | 0 | String arg = cmd.getArguments()[i].trim(); |
2000 | |
|
2001 | 0 | if ( !arg.startsWith( "@" ) ) |
2002 | |
{ |
2003 | 0 | continue; |
2004 | |
} |
2005 | |
|
2006 | 0 | File argFile = new File( javadocOutputDirectory, arg.substring( 1 ) ); |
2007 | 0 | if ( argFile.exists() ) |
2008 | |
{ |
2009 | 0 | argFile.delete(); |
2010 | |
} |
2011 | |
} |
2012 | |
|
2013 | 0 | File scriptFile = new File( javadocOutputDirectory, DEBUG_JAVADOC_SCRIPT_NAME ); |
2014 | 0 | if ( scriptFile.exists() ) |
2015 | |
{ |
2016 | 0 | scriptFile.delete(); |
2017 | |
} |
2018 | |
} |
2019 | 74 | } |
2020 | |
|
2021 | |
|
2022 | |
|
2023 | |
|
2024 | |
|
2025 | |
|
2026 | |
|
2027 | |
|
2028 | |
protected List<String> getFiles( List<String> sourcePaths ) |
2029 | |
throws MavenReportException |
2030 | |
{ |
2031 | 88 | List<String> files = new ArrayList<String>(); |
2032 | 88 | if ( StringUtils.isEmpty( subpackages ) ) |
2033 | |
{ |
2034 | 86 | String[] excludedPackages = getExcludedPackages(); |
2035 | |
|
2036 | 86 | for ( String sourcePath : sourcePaths ) |
2037 | |
{ |
2038 | 96 | File sourceDirectory = new File( sourcePath ); |
2039 | 96 | JavadocUtil.addFilesFromSource( files, sourceDirectory, sourceFileIncludes, sourceFileExcludes, excludedPackages ); |
2040 | 96 | } |
2041 | |
} |
2042 | |
|
2043 | 88 | return files; |
2044 | |
} |
2045 | |
|
2046 | |
|
2047 | |
|
2048 | |
|
2049 | |
|
2050 | |
|
2051 | |
|
2052 | |
|
2053 | |
protected List<String> getSourcePaths() |
2054 | |
throws MavenReportException |
2055 | |
{ |
2056 | |
List<String> sourcePaths; |
2057 | |
|
2058 | 88 | if ( StringUtils.isEmpty( sourcepath ) ) |
2059 | |
{ |
2060 | 84 | sourcePaths = new ArrayList<String>( JavadocUtil.pruneDirs( project, getProjectSourceRoots( project ) ) ); |
2061 | |
|
2062 | 84 | if ( project.getExecutionProject() != null ) |
2063 | |
{ |
2064 | 6 | sourcePaths.addAll( JavadocUtil.pruneDirs( project, getExecutionProjectSourceRoots( project ) ) ); |
2065 | |
} |
2066 | |
|
2067 | |
|
2068 | |
|
2069 | |
|
2070 | |
|
2071 | |
|
2072 | 84 | if ( getJavadocDirectory() != null ) |
2073 | |
{ |
2074 | 32 | File javadocDir = getJavadocDirectory(); |
2075 | 32 | if ( javadocDir.exists() && javadocDir.isDirectory() ) |
2076 | |
{ |
2077 | 6 | List<String> l = JavadocUtil.pruneDirs( project, Collections.singletonList( |
2078 | |
getJavadocDirectory().getAbsolutePath() ) ); |
2079 | 6 | sourcePaths.addAll( l ); |
2080 | |
} |
2081 | |
} |
2082 | |
|
2083 | 84 | if ( includeDependencySources ) |
2084 | |
{ |
2085 | 0 | sourcePaths.addAll( getDependencySourcePaths() ); |
2086 | |
} |
2087 | |
|
2088 | 84 | if ( isAggregator() && project.isExecutionRoot() ) |
2089 | |
{ |
2090 | 4 | for ( MavenProject subProject : reactorProjects ) |
2091 | |
{ |
2092 | 8 | if ( subProject != project ) |
2093 | |
{ |
2094 | 8 | List<String> sourceRoots = getProjectSourceRoots( subProject ); |
2095 | |
|
2096 | 8 | if ( subProject.getExecutionProject() != null ) |
2097 | |
{ |
2098 | 8 | sourceRoots.addAll( getExecutionProjectSourceRoots( subProject ) ); |
2099 | |
} |
2100 | |
|
2101 | 8 | ArtifactHandler artifactHandler = subProject.getArtifact().getArtifactHandler(); |
2102 | 8 | if ( "java".equals( artifactHandler.getLanguage() ) ) |
2103 | |
{ |
2104 | 8 | sourcePaths.addAll( JavadocUtil.pruneDirs( subProject, sourceRoots ) ); |
2105 | |
} |
2106 | |
|
2107 | 8 | if ( getJavadocDirectory() != null ) |
2108 | |
{ |
2109 | 8 | String javadocDirRelative = |
2110 | |
PathUtils.toRelative( project.getBasedir(), getJavadocDirectory().getAbsolutePath() ); |
2111 | 8 | File javadocDir = new File( subProject.getBasedir(), javadocDirRelative ); |
2112 | 8 | if ( javadocDir.exists() && javadocDir.isDirectory() ) |
2113 | |
{ |
2114 | 4 | List<String> l = JavadocUtil.pruneDirs( subProject, Collections.singletonList( |
2115 | |
javadocDir.getAbsolutePath() ) ); |
2116 | 4 | sourcePaths.addAll( l ); |
2117 | |
} |
2118 | |
} |
2119 | 8 | } |
2120 | |
} |
2121 | |
} |
2122 | |
} |
2123 | |
else |
2124 | |
{ |
2125 | 4 | sourcePaths = new ArrayList<String>( Arrays.asList( JavadocUtil.splitPath( sourcepath ) ) ); |
2126 | 4 | sourcePaths = JavadocUtil.pruneDirs( project, sourcePaths ); |
2127 | 4 | if ( getJavadocDirectory() != null ) |
2128 | |
{ |
2129 | 0 | List<String> l = JavadocUtil.pruneDirs( project, Collections.singletonList( |
2130 | |
getJavadocDirectory().getAbsolutePath() ) ); |
2131 | 0 | sourcePaths.addAll( l ); |
2132 | |
} |
2133 | |
} |
2134 | |
|
2135 | 88 | sourcePaths = JavadocUtil.pruneDirs( project, sourcePaths ); |
2136 | |
|
2137 | 88 | return sourcePaths; |
2138 | |
} |
2139 | |
|
2140 | |
|
2141 | |
|
2142 | |
|
2143 | |
|
2144 | |
protected SourceResolverConfig configureDependencySourceResolution( final SourceResolverConfig config ) |
2145 | |
{ |
2146 | 0 | return config.withCompileSources(); |
2147 | |
} |
2148 | |
|
2149 | |
|
2150 | |
|
2151 | |
|
2152 | |
|
2153 | |
protected final List<String> getDependencySourcePaths() |
2154 | |
throws MavenReportException |
2155 | |
{ |
2156 | |
try |
2157 | |
{ |
2158 | 0 | if ( sourceDependencyCacheDir.exists() ) |
2159 | |
{ |
2160 | 0 | FileUtils.forceDelete( sourceDependencyCacheDir ); |
2161 | 0 | sourceDependencyCacheDir.mkdirs(); |
2162 | |
} |
2163 | |
} |
2164 | 0 | catch ( IOException e ) |
2165 | |
{ |
2166 | 0 | throw new MavenReportException( |
2167 | |
"Failed to delete cache directory: " + sourceDependencyCacheDir + "\nReason: " + e.getMessage(), e ); |
2168 | 0 | } |
2169 | |
|
2170 | 0 | final SourceResolverConfig config = getDependencySourceResolverConfig(); |
2171 | |
|
2172 | 0 | final AndArtifactFilter andFilter = new AndArtifactFilter(); |
2173 | |
|
2174 | 0 | final List<String> dependencyIncludes = dependencySourceIncludes; |
2175 | 0 | final List<String> dependencyExcludes = dependencySourceExcludes; |
2176 | |
|
2177 | 0 | if ( !includeTransitiveDependencySources || isNotEmpty( dependencyIncludes ) || isNotEmpty( |
2178 | |
dependencyExcludes ) ) |
2179 | |
{ |
2180 | 0 | if ( !includeTransitiveDependencySources ) |
2181 | |
{ |
2182 | 0 | andFilter.add( createDependencyArtifactFilter() ); |
2183 | |
} |
2184 | |
|
2185 | 0 | if ( isNotEmpty( dependencyIncludes ) ) |
2186 | |
{ |
2187 | 0 | andFilter.add( new PatternIncludesArtifactFilter( dependencyIncludes, false ) ); |
2188 | |
} |
2189 | |
|
2190 | 0 | if ( isNotEmpty( dependencyExcludes ) ) |
2191 | |
{ |
2192 | 0 | andFilter.add( new PatternExcludesArtifactFilter( dependencyExcludes, false ) ); |
2193 | |
} |
2194 | |
|
2195 | 0 | config.withFilter( andFilter ); |
2196 | |
} |
2197 | |
|
2198 | |
try |
2199 | |
{ |
2200 | 0 | return ResourceResolver.resolveDependencySourcePaths( config ); |
2201 | |
} |
2202 | 0 | catch ( final ArtifactResolutionException e ) |
2203 | |
{ |
2204 | 0 | throw new MavenReportException( |
2205 | |
"Failed to resolve one or more javadoc source/resource artifacts:\n\n" + e.getMessage(), e ); |
2206 | |
} |
2207 | 0 | catch ( final ArtifactNotFoundException e ) |
2208 | |
{ |
2209 | 0 | throw new MavenReportException( |
2210 | |
"Failed to resolve one or more javadoc source/resource artifacts:\n\n" + e.getMessage(), e ); |
2211 | |
} |
2212 | |
} |
2213 | |
|
2214 | |
|
2215 | |
|
2216 | |
|
2217 | |
|
2218 | |
|
2219 | |
|
2220 | |
private ArtifactFilter createDependencyArtifactFilter() |
2221 | |
{ |
2222 | 0 | Set<Artifact> dependencyArtifacts = project.getDependencyArtifacts(); |
2223 | |
|
2224 | 0 | List<String> artifactPatterns = new ArrayList<String>( dependencyArtifacts.size() ); |
2225 | 0 | for ( Artifact artifact : dependencyArtifacts ) |
2226 | |
{ |
2227 | 0 | artifactPatterns.add( artifact.getGroupId() + ":" + artifact.getArtifactId() ); |
2228 | |
} |
2229 | |
|
2230 | 0 | return new IncludesArtifactFilter( artifactPatterns ); |
2231 | |
} |
2232 | |
|
2233 | |
|
2234 | |
|
2235 | |
|
2236 | |
|
2237 | |
|
2238 | |
|
2239 | |
private SourceResolverConfig getDependencySourceResolverConfig() |
2240 | |
{ |
2241 | 0 | return configureDependencySourceResolution( |
2242 | |
new SourceResolverConfig( getLog(), project, localRepository, sourceDependencyCacheDir, resolver, factory, |
2243 | |
artifactMetadataSource, archiverManager ).withReactorProjects( |
2244 | |
reactorProjects ) ); |
2245 | |
} |
2246 | |
|
2247 | |
|
2248 | |
|
2249 | |
|
2250 | |
|
2251 | |
|
2252 | |
|
2253 | |
|
2254 | |
protected boolean canGenerateReport( List<String> files ) |
2255 | |
{ |
2256 | 88 | boolean canGenerate = true; |
2257 | |
|
2258 | 88 | if ( files.isEmpty() && StringUtils.isEmpty( subpackages ) ) |
2259 | |
{ |
2260 | 2 | canGenerate = false; |
2261 | |
} |
2262 | |
|
2263 | 88 | return canGenerate; |
2264 | |
} |
2265 | |
|
2266 | |
|
2267 | |
|
2268 | |
|
2269 | |
|
2270 | |
|
2271 | |
protected List<Artifact> getCompileArtifacts( ArtifactResolutionResult result ) |
2272 | |
{ |
2273 | 0 | return JavadocUtil.getCompileArtifacts( result.getArtifacts(), false ); |
2274 | |
} |
2275 | |
|
2276 | |
|
2277 | |
|
2278 | |
|
2279 | |
|
2280 | |
|
2281 | |
|
2282 | |
|
2283 | |
|
2284 | |
|
2285 | |
|
2286 | |
|
2287 | |
|
2288 | |
private String getExcludedPackages( List<String> sourcePaths ) |
2289 | |
throws MavenReportException |
2290 | |
{ |
2291 | 82 | List<String> excludedNames = null; |
2292 | |
|
2293 | 82 | if ( StringUtils.isNotEmpty( sourcepath ) && StringUtils.isNotEmpty( subpackages ) ) |
2294 | |
{ |
2295 | 2 | String[] excludedPackages = getExcludedPackages(); |
2296 | 2 | String[] subpackagesList = subpackages.split( "[:]" ); |
2297 | |
|
2298 | 2 | excludedNames = JavadocUtil.getExcludedNames( sourcePaths, subpackagesList, excludedPackages ); |
2299 | |
} |
2300 | |
|
2301 | 82 | String excludeArg = ""; |
2302 | 82 | if ( StringUtils.isNotEmpty( subpackages ) && excludedNames != null ) |
2303 | |
{ |
2304 | |
|
2305 | 2 | excludeArg = StringUtils.join( excludedNames.iterator(), ":" ); |
2306 | |
} |
2307 | |
|
2308 | 82 | return excludeArg; |
2309 | |
} |
2310 | |
|
2311 | |
|
2312 | |
|
2313 | |
|
2314 | |
|
2315 | |
|
2316 | |
|
2317 | |
|
2318 | |
|
2319 | |
private String getSourcePath( List<String> sourcePaths ) |
2320 | |
{ |
2321 | 82 | String sourcePath = null; |
2322 | |
|
2323 | 82 | if ( StringUtils.isEmpty( subpackages ) || StringUtils.isNotEmpty( sourcepath ) ) |
2324 | |
{ |
2325 | 82 | sourcePath = StringUtils.join( sourcePaths.iterator(), File.pathSeparator ); |
2326 | |
} |
2327 | |
|
2328 | 82 | return sourcePath; |
2329 | |
} |
2330 | |
|
2331 | |
|
2332 | |
|
2333 | |
|
2334 | |
|
2335 | |
|
2336 | |
|
2337 | |
|
2338 | |
private String[] getExcludedPackages() |
2339 | |
throws MavenReportException |
2340 | |
{ |
2341 | 88 | Set<String> excluded = new LinkedHashSet<String>(); |
2342 | |
|
2343 | 88 | if ( includeDependencySources ) |
2344 | |
{ |
2345 | |
try |
2346 | |
{ |
2347 | 0 | resolveDependencyBundles(); |
2348 | |
} |
2349 | 0 | catch ( IOException e ) |
2350 | |
{ |
2351 | 0 | throw new MavenReportException( |
2352 | |
"Failed to resolve javadoc bundles from dependencies: " + e.getMessage(), e ); |
2353 | 0 | } |
2354 | |
|
2355 | 0 | if ( isNotEmpty( dependencyJavadocBundles ) ) |
2356 | |
{ |
2357 | 0 | for ( JavadocBundle bundle : dependencyJavadocBundles ) |
2358 | |
{ |
2359 | 0 | JavadocOptions options = bundle.getOptions(); |
2360 | 0 | if ( options != null && isNotEmpty( options.getExcludePackageNames() ) ) |
2361 | |
{ |
2362 | 0 | excluded.addAll( options.getExcludePackageNames() ); |
2363 | |
} |
2364 | 0 | } |
2365 | |
} |
2366 | |
} |
2367 | |
|
2368 | |
|
2369 | 88 | if ( StringUtils.isNotEmpty( excludePackageNames ) ) |
2370 | |
{ |
2371 | 4 | excluded.addAll( Arrays.asList( excludePackageNames.split( "[,:;]" ) ) ); |
2372 | |
} |
2373 | |
|
2374 | 88 | String[] result = new String[excluded.size()]; |
2375 | 88 | if ( isNotEmpty( excluded ) ) |
2376 | |
{ |
2377 | 4 | int idx = 0; |
2378 | 4 | for ( String exclude : excluded ) |
2379 | |
{ |
2380 | 8 | result[idx] = exclude.replace( '.', File.separatorChar ); |
2381 | 8 | idx++; |
2382 | |
} |
2383 | |
} |
2384 | |
|
2385 | 88 | return result; |
2386 | |
} |
2387 | |
|
2388 | |
|
2389 | |
|
2390 | |
|
2391 | |
|
2392 | |
|
2393 | |
|
2394 | |
|
2395 | |
|
2396 | |
|
2397 | |
private String getClasspath() |
2398 | |
throws MavenReportException |
2399 | |
{ |
2400 | 82 | List<String> classpathElements = new ArrayList<String>(); |
2401 | 82 | Map<String, Artifact> compileArtifactMap = new HashMap<String, Artifact>(); |
2402 | |
|
2403 | 82 | classpathElements.addAll( getProjectBuildOutputDirs( project ) ); |
2404 | |
|
2405 | 82 | populateCompileArtifactMap( compileArtifactMap, getProjectArtifacts( project ) ); |
2406 | |
|
2407 | 82 | if ( isAggregator() && project.isExecutionRoot() ) |
2408 | |
{ |
2409 | |
try |
2410 | |
{ |
2411 | 4 | for ( MavenProject subProject : reactorProjects ) |
2412 | |
{ |
2413 | 8 | if ( subProject != project ) |
2414 | |
{ |
2415 | 8 | classpathElements.addAll( getProjectBuildOutputDirs( subProject ) ); |
2416 | |
|
2417 | 8 | Set<Artifact> dependencyArtifacts = subProject.createArtifacts( factory, null, null ); |
2418 | 8 | if ( !dependencyArtifacts.isEmpty() ) |
2419 | |
{ |
2420 | 0 | ArtifactResolutionResult result = null; |
2421 | |
try |
2422 | |
{ |
2423 | 0 | result = resolver.resolveTransitively( dependencyArtifacts, subProject.getArtifact(), |
2424 | |
subProject.getManagedVersionMap(), |
2425 | |
localRepository, |
2426 | |
subProject.getRemoteArtifactRepositories(), |
2427 | |
artifactMetadataSource ); |
2428 | |
} |
2429 | 0 | catch ( MultipleArtifactsNotFoundException e ) |
2430 | |
{ |
2431 | 0 | if ( checkMissingArtifactsInReactor( dependencyArtifacts, e.getMissingArtifacts() ) ) |
2432 | |
{ |
2433 | 0 | getLog().warn( "IGNORED to add some artifacts in the classpath. See above." ); |
2434 | |
} |
2435 | |
else |
2436 | |
{ |
2437 | |
|
2438 | 0 | throw new MavenReportException( e.getMessage(), e ); |
2439 | |
} |
2440 | |
} |
2441 | 0 | catch ( ArtifactNotFoundException e ) |
2442 | |
{ |
2443 | 0 | throw new MavenReportException( e.getMessage(), e ); |
2444 | |
} |
2445 | 0 | catch ( ArtifactResolutionException e ) |
2446 | |
{ |
2447 | 0 | throw new MavenReportException( e.getMessage(), e ); |
2448 | 0 | } |
2449 | |
|
2450 | 0 | if ( result == null ) |
2451 | |
{ |
2452 | 0 | continue; |
2453 | |
} |
2454 | |
|
2455 | 0 | populateCompileArtifactMap( compileArtifactMap, getCompileArtifacts( result ) ); |
2456 | |
|
2457 | 0 | if ( getLog().isDebugEnabled() ) |
2458 | |
{ |
2459 | 0 | StringBuilder sb = new StringBuilder(); |
2460 | |
|
2461 | 0 | sb.append( "Compiled artifacts for " ); |
2462 | 0 | sb.append( subProject.getGroupId() ).append( ":" ); |
2463 | 0 | sb.append( subProject.getArtifactId() ).append( ":" ); |
2464 | 0 | sb.append( subProject.getVersion() ).append( '\n' ); |
2465 | 0 | for ( Artifact a : compileArtifactMap.values() ) |
2466 | |
{ |
2467 | 0 | sb.append( a.getFile() ).append( '\n' ); |
2468 | |
} |
2469 | |
|
2470 | 0 | getLog().debug( sb.toString() ); |
2471 | |
} |
2472 | |
} |
2473 | 8 | } |
2474 | |
} |
2475 | |
} |
2476 | 0 | catch ( InvalidDependencyVersionException e ) |
2477 | |
{ |
2478 | 0 | throw new MavenReportException( e.getMessage(), e ); |
2479 | 4 | } |
2480 | |
} |
2481 | |
|
2482 | 82 | for ( Artifact a : compileArtifactMap.values() ) |
2483 | |
{ |
2484 | 2 | classpathElements.add( a.getFile().toString() ); |
2485 | |
} |
2486 | |
|
2487 | 82 | if ( additionalDependencies != null ) |
2488 | |
{ |
2489 | 0 | for ( Dependency dependency : additionalDependencies ) |
2490 | |
{ |
2491 | 0 | Artifact artifact = resolveDependency( dependency ); |
2492 | 0 | String path = artifact.getFile().toString(); |
2493 | 0 | getLog().debug( "add additional artifact with path " + path ); |
2494 | 0 | classpathElements.add( path ); |
2495 | 0 | } |
2496 | |
} |
2497 | |
|
2498 | 82 | return StringUtils.join( classpathElements.iterator(), File.pathSeparator ); |
2499 | |
} |
2500 | |
|
2501 | |
public Artifact resolveDependency( Dependency dependency ) |
2502 | |
throws MavenReportException |
2503 | |
{ |
2504 | 0 | Artifact artifact = factory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(), |
2505 | |
dependency.getVersion(), dependency.getType(), |
2506 | |
dependency.getClassifier() ); |
2507 | |
try |
2508 | |
{ |
2509 | 0 | resolver.resolve( artifact, remoteRepositories, localRepository ); |
2510 | |
} |
2511 | 0 | catch ( ArtifactNotFoundException e ) |
2512 | |
{ |
2513 | 0 | throw new MavenReportException( "artifact not found - " + e.getMessage(), e ); |
2514 | |
} |
2515 | 0 | catch ( ArtifactResolutionException e ) |
2516 | |
{ |
2517 | 0 | throw new MavenReportException( "artifact resolver problem - " + e.getMessage(), e ); |
2518 | 0 | } |
2519 | 0 | return artifact; |
2520 | |
} |
2521 | |
|
2522 | |
|
2523 | |
|
2524 | |
|
2525 | |
|
2526 | |
|
2527 | |
|
2528 | |
|
2529 | |
private Toolchain getToolchain() |
2530 | |
{ |
2531 | 86 | Toolchain tc = null; |
2532 | 86 | if ( toolchainManager != null ) |
2533 | |
{ |
2534 | 86 | tc = toolchainManager.getToolchainFromBuildContext( "jdk", session ); |
2535 | |
} |
2536 | |
|
2537 | 86 | return tc; |
2538 | |
} |
2539 | |
|
2540 | |
|
2541 | |
|
2542 | |
|
2543 | |
|
2544 | |
|
2545 | |
|
2546 | |
|
2547 | |
private void populateCompileArtifactMap( Map<String, Artifact> compileArtifactMap, |
2548 | |
Collection<Artifact> artifactList ) |
2549 | |
throws MavenReportException |
2550 | |
{ |
2551 | 86 | if ( artifactList == null ) |
2552 | |
{ |
2553 | 0 | return; |
2554 | |
} |
2555 | |
|
2556 | 86 | for ( Artifact newArtifact : artifactList ) |
2557 | |
{ |
2558 | 178 | File file = newArtifact.getFile(); |
2559 | |
|
2560 | 178 | if ( file == null ) |
2561 | |
{ |
2562 | 0 | throw new MavenReportException( |
2563 | |
"Error in plugin descriptor - " + "dependency was not resolved for artifact: " |
2564 | |
+ newArtifact.getGroupId() + ":" + newArtifact.getArtifactId() + ":" |
2565 | |
+ newArtifact.getVersion() ); |
2566 | |
} |
2567 | |
|
2568 | 178 | if ( compileArtifactMap.get( newArtifact.getDependencyConflictId() ) != null ) |
2569 | |
{ |
2570 | 0 | Artifact oldArtifact = compileArtifactMap.get( newArtifact.getDependencyConflictId() ); |
2571 | |
|
2572 | 0 | ArtifactVersion oldVersion = new DefaultArtifactVersion( oldArtifact.getVersion() ); |
2573 | 0 | ArtifactVersion newVersion = new DefaultArtifactVersion( newArtifact.getVersion() ); |
2574 | 0 | if ( newVersion.compareTo( oldVersion ) > 0 ) |
2575 | |
{ |
2576 | 0 | compileArtifactMap.put( newArtifact.getDependencyConflictId(), newArtifact ); |
2577 | |
} |
2578 | 0 | } |
2579 | |
else |
2580 | |
{ |
2581 | 178 | compileArtifactMap.put( newArtifact.getDependencyConflictId(), newArtifact ); |
2582 | |
} |
2583 | 178 | } |
2584 | 86 | } |
2585 | |
|
2586 | |
|
2587 | |
|
2588 | |
|
2589 | |
|
2590 | |
|
2591 | |
|
2592 | |
private String getBottomText() |
2593 | |
{ |
2594 | 70 | int actualYear = Calendar.getInstance().get( Calendar.YEAR ); |
2595 | 70 | String year = String.valueOf( actualYear ); |
2596 | |
|
2597 | 70 | String inceptionYear = project.getInceptionYear(); |
2598 | |
|
2599 | 70 | String theBottom = StringUtils.replace( this.bottom, "{currentYear}", year ); |
2600 | |
|
2601 | 70 | if ( inceptionYear != null ) |
2602 | |
{ |
2603 | 0 | if ( inceptionYear.equals( year ) ) |
2604 | |
{ |
2605 | 0 | theBottom = StringUtils.replace( theBottom, "{inceptionYear}-", "" ); |
2606 | |
} |
2607 | |
else |
2608 | |
{ |
2609 | 0 | theBottom = StringUtils.replace( theBottom, "{inceptionYear}", inceptionYear ); |
2610 | |
} |
2611 | |
} |
2612 | |
else |
2613 | |
{ |
2614 | 70 | theBottom = StringUtils.replace( theBottom, "{inceptionYear}-", "" ); |
2615 | |
} |
2616 | |
|
2617 | 70 | if ( project.getOrganization() == null ) |
2618 | |
{ |
2619 | 70 | theBottom = StringUtils.replace( theBottom, " {organizationName}", "" ); |
2620 | |
} |
2621 | |
else |
2622 | |
{ |
2623 | 0 | if ( StringUtils.isNotEmpty( project.getOrganization().getName() ) ) |
2624 | |
{ |
2625 | 0 | if ( StringUtils.isNotEmpty( project.getOrganization().getUrl() ) ) |
2626 | |
{ |
2627 | 0 | theBottom = StringUtils.replace( theBottom, "{organizationName}", |
2628 | |
"<a href=\"" + project.getOrganization().getUrl() + "\">" |
2629 | |
+ project.getOrganization().getName() + "</a>" ); |
2630 | |
} |
2631 | |
else |
2632 | |
{ |
2633 | 0 | theBottom = |
2634 | |
StringUtils.replace( theBottom, "{organizationName}", project.getOrganization().getName() ); |
2635 | |
} |
2636 | |
} |
2637 | |
else |
2638 | |
{ |
2639 | 0 | theBottom = StringUtils.replace( theBottom, " {organizationName}", "" ); |
2640 | |
} |
2641 | |
} |
2642 | |
|
2643 | 70 | return theBottom; |
2644 | |
} |
2645 | |
|
2646 | |
|
2647 | |
|
2648 | |
|
2649 | |
|
2650 | |
|
2651 | |
|
2652 | |
|
2653 | |
|
2654 | |
|
2655 | |
|
2656 | |
|
2657 | |
|
2658 | |
|
2659 | |
|
2660 | |
|
2661 | |
private String getStylesheetFile( final File javadocOutputDirectory ) |
2662 | |
{ |
2663 | 70 | if ( StringUtils.isEmpty( stylesheetfile ) ) |
2664 | |
{ |
2665 | 64 | if ( "java".equalsIgnoreCase( stylesheet ) ) |
2666 | |
{ |
2667 | |
|
2668 | 60 | return null; |
2669 | |
} |
2670 | |
|
2671 | |
|
2672 | 4 | return new File( javadocOutputDirectory, DEFAULT_CSS_NAME ).getAbsolutePath(); |
2673 | |
} |
2674 | |
|
2675 | 6 | if ( new File( stylesheetfile ).exists() ) |
2676 | |
{ |
2677 | 2 | return new File( stylesheetfile ).getAbsolutePath(); |
2678 | |
} |
2679 | |
|
2680 | 4 | return getResource( new File( javadocOutputDirectory, DEFAULT_CSS_NAME ), stylesheetfile ); |
2681 | |
} |
2682 | |
|
2683 | |
|
2684 | |
|
2685 | |
|
2686 | |
|
2687 | |
|
2688 | |
|
2689 | |
|
2690 | |
|
2691 | |
|
2692 | |
|
2693 | |
|
2694 | |
|
2695 | |
private String getHelpFile( final File javadocOutputDirectory ) |
2696 | |
{ |
2697 | 70 | if ( StringUtils.isEmpty( helpfile ) ) |
2698 | |
{ |
2699 | 64 | return null; |
2700 | |
} |
2701 | |
|
2702 | 6 | if ( new File( helpfile ).exists() ) |
2703 | |
{ |
2704 | 2 | return new File( helpfile ).getAbsolutePath(); |
2705 | |
} |
2706 | |
|
2707 | 4 | return getResource( new File( javadocOutputDirectory, "help-doc.html" ), helpfile ); |
2708 | |
} |
2709 | |
|
2710 | |
|
2711 | |
|
2712 | |
|
2713 | |
|
2714 | |
|
2715 | |
|
2716 | |
|
2717 | |
private String getAccessLevel() |
2718 | |
{ |
2719 | |
String accessLevel; |
2720 | 82 | if ( "public".equalsIgnoreCase( show ) || "protected".equalsIgnoreCase( show ) || "package".equalsIgnoreCase( |
2721 | |
show ) || "private".equalsIgnoreCase( show ) ) |
2722 | |
{ |
2723 | 82 | accessLevel = "-" + show; |
2724 | |
} |
2725 | |
else |
2726 | |
{ |
2727 | 0 | if ( getLog().isErrorEnabled() ) |
2728 | |
{ |
2729 | 0 | getLog().error( "Unrecognized access level to show '" + show + "'. Defaulting to protected." ); |
2730 | |
} |
2731 | 0 | accessLevel = "-protected"; |
2732 | |
} |
2733 | |
|
2734 | 82 | return accessLevel; |
2735 | |
} |
2736 | |
|
2737 | |
|
2738 | |
|
2739 | |
|
2740 | |
|
2741 | |
|
2742 | |
|
2743 | |
|
2744 | |
|
2745 | |
private String getBootclassPath() |
2746 | |
throws MavenReportException |
2747 | |
{ |
2748 | 82 | Set<BootclasspathArtifact> bootclasspathArtifacts = collectBootClasspathArtifacts(); |
2749 | |
|
2750 | 82 | List<String> bootclassPath = new ArrayList<String>(); |
2751 | 82 | for ( BootclasspathArtifact aBootclasspathArtifact : bootclasspathArtifacts ) |
2752 | |
{ |
2753 | 0 | if ( ( StringUtils.isNotEmpty( aBootclasspathArtifact.getGroupId() ) ) && ( StringUtils.isNotEmpty( |
2754 | |
aBootclasspathArtifact.getArtifactId() ) ) && ( StringUtils.isNotEmpty( |
2755 | |
aBootclasspathArtifact.getVersion() ) ) ) |
2756 | |
{ |
2757 | 0 | bootclassPath.addAll( getArtifactsAbsolutePath( aBootclasspathArtifact ) ); |
2758 | |
} |
2759 | |
} |
2760 | |
|
2761 | 82 | bootclassPath = JavadocUtil.pruneFiles( bootclassPath ); |
2762 | |
|
2763 | 82 | StringBuilder path = new StringBuilder(); |
2764 | 82 | path.append( StringUtils.join( bootclassPath.iterator(), File.pathSeparator ) ); |
2765 | |
|
2766 | 82 | if ( StringUtils.isNotEmpty( bootclasspath ) ) |
2767 | |
{ |
2768 | 0 | path.append( JavadocUtil.unifyPathSeparator( bootclasspath ) ); |
2769 | |
} |
2770 | |
|
2771 | 82 | return path.toString(); |
2772 | |
} |
2773 | |
|
2774 | |
|
2775 | |
|
2776 | |
|
2777 | |
|
2778 | |
|
2779 | |
|
2780 | |
|
2781 | |
|
2782 | |
|
2783 | |
|
2784 | |
|
2785 | |
|
2786 | |
private String getDocletPath() |
2787 | |
throws MavenReportException |
2788 | |
{ |
2789 | 4 | Set<DocletArtifact> docletArtifacts = collectDocletArtifacts(); |
2790 | 4 | List<String> pathParts = new ArrayList<String>(); |
2791 | |
|
2792 | 4 | for ( DocletArtifact docletArtifact : docletArtifacts ) |
2793 | |
{ |
2794 | 6 | if ( !isDocletArtifactEmpty( docletArtifact ) ) |
2795 | |
{ |
2796 | 6 | pathParts.addAll( getArtifactsAbsolutePath( docletArtifact ) ); |
2797 | |
} |
2798 | |
} |
2799 | |
|
2800 | 4 | if ( !StringUtils.isEmpty( docletPath ) ) |
2801 | |
{ |
2802 | 0 | pathParts.add( JavadocUtil.unifyPathSeparator( docletPath ) ); |
2803 | |
} |
2804 | |
|
2805 | 4 | String path = StringUtils.join( pathParts.iterator(), File.pathSeparator ); |
2806 | |
|
2807 | 4 | if ( StringUtils.isEmpty( path ) && getLog().isWarnEnabled() ) |
2808 | |
{ |
2809 | 0 | getLog().warn( "No docletpath option was found. Please review <docletpath/> or <docletArtifact/>" |
2810 | |
+ " or <doclets/>." ); |
2811 | |
} |
2812 | |
|
2813 | 4 | return path.toString(); |
2814 | |
} |
2815 | |
|
2816 | |
|
2817 | |
|
2818 | |
|
2819 | |
|
2820 | |
|
2821 | |
|
2822 | |
|
2823 | |
private boolean isDocletArtifactEmpty( DocletArtifact aDocletArtifact ) |
2824 | |
{ |
2825 | 6 | if ( aDocletArtifact == null ) |
2826 | |
{ |
2827 | 0 | return true; |
2828 | |
} |
2829 | |
|
2830 | 6 | return StringUtils.isEmpty( aDocletArtifact.getGroupId() ) && StringUtils.isEmpty( |
2831 | |
aDocletArtifact.getArtifactId() ) && StringUtils.isEmpty( aDocletArtifact.getVersion() ); |
2832 | |
} |
2833 | |
|
2834 | |
|
2835 | |
|
2836 | |
|
2837 | |
|
2838 | |
|
2839 | |
|
2840 | |
|
2841 | |
|
2842 | |
private String getTagletPath() |
2843 | |
throws MavenReportException |
2844 | |
{ |
2845 | 70 | Set<TagletArtifact> tArtifacts = collectTagletArtifacts(); |
2846 | 70 | List<String> pathParts = new ArrayList<String>(); |
2847 | |
|
2848 | 70 | for ( TagletArtifact tagletArtifact : tArtifacts ) |
2849 | |
{ |
2850 | 6 | if ( ( tagletArtifact != null ) && ( StringUtils.isNotEmpty( tagletArtifact.getGroupId() ) ) |
2851 | |
&& ( StringUtils.isNotEmpty( tagletArtifact.getArtifactId() ) ) && ( StringUtils.isNotEmpty( |
2852 | |
tagletArtifact.getVersion() ) ) ) |
2853 | |
{ |
2854 | 6 | pathParts.addAll( getArtifactsAbsolutePath( tagletArtifact ) ); |
2855 | |
} |
2856 | |
} |
2857 | |
|
2858 | 70 | Set<Taglet> taglets = collectTaglets(); |
2859 | 70 | for ( Taglet taglet : taglets ) |
2860 | |
{ |
2861 | 0 | if ( taglet == null ) |
2862 | |
{ |
2863 | 0 | continue; |
2864 | |
} |
2865 | |
|
2866 | 0 | if ( ( taglet.getTagletArtifact() != null ) && ( StringUtils.isNotEmpty( |
2867 | |
taglet.getTagletArtifact().getGroupId() ) ) && ( StringUtils.isNotEmpty( |
2868 | |
taglet.getTagletArtifact().getArtifactId() ) ) && ( StringUtils.isNotEmpty( |
2869 | |
taglet.getTagletArtifact().getVersion() ) ) ) |
2870 | |
{ |
2871 | 0 | pathParts.addAll( getArtifactsAbsolutePath( taglet.getTagletArtifact() ) ); |
2872 | |
|
2873 | 0 | pathParts = JavadocUtil.pruneFiles( pathParts ); |
2874 | |
} |
2875 | 0 | else if ( StringUtils.isNotEmpty( taglet.getTagletpath() ) ) |
2876 | |
{ |
2877 | 0 | pathParts.add( taglet.getTagletpath() ); |
2878 | |
|
2879 | 0 | pathParts = JavadocUtil.pruneDirs( project, pathParts ); |
2880 | |
} |
2881 | |
} |
2882 | |
|
2883 | 70 | StringBuilder path = new StringBuilder(); |
2884 | 70 | path.append( StringUtils.join( pathParts.iterator(), File.pathSeparator ) ); |
2885 | |
|
2886 | 70 | if ( StringUtils.isNotEmpty( tagletpath ) ) |
2887 | |
{ |
2888 | 0 | path.append( JavadocUtil.unifyPathSeparator( tagletpath ) ); |
2889 | |
} |
2890 | |
|
2891 | 70 | return path.toString(); |
2892 | |
} |
2893 | |
|
2894 | |
private Set<String> collectLinks() |
2895 | |
throws MavenReportException |
2896 | |
{ |
2897 | 68 | Set<String> links = new LinkedHashSet<String>(); |
2898 | |
|
2899 | 68 | if ( includeDependencySources ) |
2900 | |
{ |
2901 | |
try |
2902 | |
{ |
2903 | 0 | resolveDependencyBundles(); |
2904 | |
} |
2905 | 0 | catch ( IOException e ) |
2906 | |
{ |
2907 | 0 | throw new MavenReportException( |
2908 | |
"Failed to resolve javadoc bundles from dependencies: " + e.getMessage(), e ); |
2909 | 0 | } |
2910 | |
|
2911 | 0 | if ( isNotEmpty( dependencyJavadocBundles ) ) |
2912 | |
{ |
2913 | 0 | for ( JavadocBundle bundle : dependencyJavadocBundles ) |
2914 | |
{ |
2915 | 0 | JavadocOptions options = bundle.getOptions(); |
2916 | 0 | if ( options != null && isNotEmpty( options.getLinks() ) ) |
2917 | |
{ |
2918 | 0 | links.addAll( options.getLinks() ); |
2919 | |
} |
2920 | 0 | } |
2921 | |
} |
2922 | |
} |
2923 | |
|
2924 | 68 | if ( isNotEmpty( this.links ) ) |
2925 | |
{ |
2926 | 2 | links.addAll( this.links ); |
2927 | |
} |
2928 | |
|
2929 | 68 | links.addAll( getDependenciesLinks() ); |
2930 | |
|
2931 | 68 | return links; |
2932 | |
} |
2933 | |
|
2934 | |
private Set<Group> collectGroups() |
2935 | |
throws MavenReportException |
2936 | |
{ |
2937 | 70 | Set<Group> groups = new LinkedHashSet<Group>(); |
2938 | |
|
2939 | 70 | if ( includeDependencySources ) |
2940 | |
{ |
2941 | |
try |
2942 | |
{ |
2943 | 0 | resolveDependencyBundles(); |
2944 | |
} |
2945 | 0 | catch ( IOException e ) |
2946 | |
{ |
2947 | 0 | throw new MavenReportException( |
2948 | |
"Failed to resolve javadoc bundles from dependencies: " + e.getMessage(), e ); |
2949 | 0 | } |
2950 | |
|
2951 | 0 | if ( isNotEmpty( dependencyJavadocBundles ) ) |
2952 | |
{ |
2953 | 0 | for ( JavadocBundle bundle : dependencyJavadocBundles ) |
2954 | |
{ |
2955 | 0 | JavadocOptions options = bundle.getOptions(); |
2956 | 0 | if ( options != null && isNotEmpty( options.getGroups() ) ) |
2957 | |
{ |
2958 | 0 | groups.addAll( options.getGroups() ); |
2959 | |
} |
2960 | 0 | } |
2961 | |
} |
2962 | |
} |
2963 | |
|
2964 | 70 | if ( this.groups != null && this.groups.length > 0 ) |
2965 | |
{ |
2966 | 2 | groups.addAll( Arrays.asList( this.groups ) ); |
2967 | |
} |
2968 | |
|
2969 | 70 | return groups; |
2970 | |
} |
2971 | |
|
2972 | |
private Set<ResourcesArtifact> collectResourcesArtifacts() |
2973 | |
throws MavenReportException |
2974 | |
{ |
2975 | 86 | Set<ResourcesArtifact> result = new LinkedHashSet<ResourcesArtifact>(); |
2976 | |
|
2977 | 86 | if ( includeDependencySources ) |
2978 | |
{ |
2979 | |
try |
2980 | |
{ |
2981 | 0 | resolveDependencyBundles(); |
2982 | |
} |
2983 | 0 | catch ( IOException e ) |
2984 | |
{ |
2985 | 0 | throw new MavenReportException( |
2986 | |
"Failed to resolve javadoc bundles from dependencies: " + e.getMessage(), e ); |
2987 | 0 | } |
2988 | |
|
2989 | 0 | if ( isNotEmpty( dependencyJavadocBundles ) ) |
2990 | |
{ |
2991 | 0 | for ( JavadocBundle bundle : dependencyJavadocBundles ) |
2992 | |
{ |
2993 | 0 | JavadocOptions options = bundle.getOptions(); |
2994 | 0 | if ( options != null && isNotEmpty( options.getResourcesArtifacts() ) ) |
2995 | |
{ |
2996 | 0 | result.addAll( options.getResourcesArtifacts() ); |
2997 | |
} |
2998 | 0 | } |
2999 | |
} |
3000 | |
} |
3001 | |
|
3002 | 86 | if ( this.resourcesArtifacts != null && this.resourcesArtifacts.length > 0 ) |
3003 | |
{ |
3004 | 0 | result.addAll( Arrays.asList( this.resourcesArtifacts ) ); |
3005 | |
} |
3006 | |
|
3007 | 86 | return result; |
3008 | |
} |
3009 | |
|
3010 | |
private Set<BootclasspathArtifact> collectBootClasspathArtifacts() |
3011 | |
throws MavenReportException |
3012 | |
{ |
3013 | 82 | Set<BootclasspathArtifact> result = new LinkedHashSet<BootclasspathArtifact>(); |
3014 | |
|
3015 | 82 | if ( includeDependencySources ) |
3016 | |
{ |
3017 | |
try |
3018 | |
{ |
3019 | 0 | resolveDependencyBundles(); |
3020 | |
} |
3021 | 0 | catch ( IOException e ) |
3022 | |
{ |
3023 | 0 | throw new MavenReportException( |
3024 | |
"Failed to resolve javadoc bundles from dependencies: " + e.getMessage(), e ); |
3025 | 0 | } |
3026 | |
|
3027 | 0 | if ( isNotEmpty( dependencyJavadocBundles ) ) |
3028 | |
{ |
3029 | 0 | for ( JavadocBundle bundle : dependencyJavadocBundles ) |
3030 | |
{ |
3031 | 0 | JavadocOptions options = bundle.getOptions(); |
3032 | 0 | if ( options != null && isNotEmpty( options.getBootclasspathArtifacts() ) ) |
3033 | |
{ |
3034 | 0 | result.addAll( options.getBootclasspathArtifacts() ); |
3035 | |
} |
3036 | 0 | } |
3037 | |
} |
3038 | |
} |
3039 | |
|
3040 | 82 | if ( this.bootclasspathArtifacts != null && this.bootclasspathArtifacts.length > 0 ) |
3041 | |
{ |
3042 | 0 | result.addAll( Arrays.asList( this.bootclasspathArtifacts ) ); |
3043 | |
} |
3044 | |
|
3045 | 82 | return result; |
3046 | |
} |
3047 | |
|
3048 | |
private Set<OfflineLink> collectOfflineLinks() |
3049 | |
throws MavenReportException |
3050 | |
{ |
3051 | 70 | Set<OfflineLink> result = new LinkedHashSet<OfflineLink>(); |
3052 | |
|
3053 | 70 | OfflineLink javaApiLink = getDefaultJavadocApiLink(); |
3054 | 70 | if ( javaApiLink != null ) |
3055 | |
{ |
3056 | 2 | result.add( javaApiLink ); |
3057 | |
} |
3058 | |
|
3059 | 70 | if ( includeDependencySources ) |
3060 | |
{ |
3061 | |
try |
3062 | |
{ |
3063 | 0 | resolveDependencyBundles(); |
3064 | |
} |
3065 | 0 | catch ( IOException e ) |
3066 | |
{ |
3067 | 0 | throw new MavenReportException( |
3068 | |
"Failed to resolve javadoc bundles from dependencies: " + e.getMessage(), e ); |
3069 | 0 | } |
3070 | |
|
3071 | 0 | if ( isNotEmpty( dependencyJavadocBundles ) ) |
3072 | |
{ |
3073 | 0 | for ( JavadocBundle bundle : dependencyJavadocBundles ) |
3074 | |
{ |
3075 | 0 | JavadocOptions options = bundle.getOptions(); |
3076 | 0 | if ( options != null && isNotEmpty( options.getOfflineLinks() ) ) |
3077 | |
{ |
3078 | 0 | result.addAll( options.getOfflineLinks() ); |
3079 | |
} |
3080 | 0 | } |
3081 | |
} |
3082 | |
} |
3083 | |
|
3084 | 70 | if ( this.offlineLinks != null && this.offlineLinks.length > 0 ) |
3085 | |
{ |
3086 | 2 | result.addAll( Arrays.asList( this.offlineLinks ) ); |
3087 | |
} |
3088 | |
|
3089 | 70 | return result; |
3090 | |
} |
3091 | |
|
3092 | |
private Set<Tag> collectTags() |
3093 | |
throws MavenReportException |
3094 | |
{ |
3095 | 70 | Set<Tag> tags = new LinkedHashSet<Tag>(); |
3096 | |
|
3097 | 70 | if ( includeDependencySources ) |
3098 | |
{ |
3099 | |
try |
3100 | |
{ |
3101 | 0 | resolveDependencyBundles(); |
3102 | |
} |
3103 | 0 | catch ( IOException e ) |
3104 | |
{ |
3105 | 0 | throw new MavenReportException( |
3106 | |
"Failed to resolve javadoc bundles from dependencies: " + e.getMessage(), e ); |
3107 | 0 | } |
3108 | |
|
3109 | 0 | if ( isNotEmpty( dependencyJavadocBundles ) ) |
3110 | |
{ |
3111 | 0 | for ( JavadocBundle bundle : dependencyJavadocBundles ) |
3112 | |
{ |
3113 | 0 | JavadocOptions options = bundle.getOptions(); |
3114 | 0 | if ( options != null && isNotEmpty( options.getTags() ) ) |
3115 | |
{ |
3116 | 0 | tags.addAll( options.getTags() ); |
3117 | |
} |
3118 | 0 | } |
3119 | |
} |
3120 | |
} |
3121 | |
|
3122 | 70 | if ( this.tags != null && this.tags.length > 0 ) |
3123 | |
{ |
3124 | 4 | tags.addAll( Arrays.asList( this.tags ) ); |
3125 | |
} |
3126 | |
|
3127 | 70 | return tags; |
3128 | |
} |
3129 | |
|
3130 | |
private Set<TagletArtifact> collectTagletArtifacts() |
3131 | |
throws MavenReportException |
3132 | |
{ |
3133 | 70 | Set<TagletArtifact> tArtifacts = new LinkedHashSet<TagletArtifact>(); |
3134 | |
|
3135 | 70 | if ( includeDependencySources ) |
3136 | |
{ |
3137 | |
try |
3138 | |
{ |
3139 | 0 | resolveDependencyBundles(); |
3140 | |
} |
3141 | 0 | catch ( IOException e ) |
3142 | |
{ |
3143 | 0 | throw new MavenReportException( |
3144 | |
"Failed to resolve javadoc bundles from dependencies: " + e.getMessage(), e ); |
3145 | 0 | } |
3146 | |
|
3147 | 0 | if ( isNotEmpty( dependencyJavadocBundles ) ) |
3148 | |
{ |
3149 | 0 | for ( JavadocBundle bundle : dependencyJavadocBundles ) |
3150 | |
{ |
3151 | 0 | JavadocOptions options = bundle.getOptions(); |
3152 | 0 | if ( options != null && isNotEmpty( options.getTagletArtifacts() ) ) |
3153 | |
{ |
3154 | 0 | tArtifacts.addAll( options.getTagletArtifacts() ); |
3155 | |
} |
3156 | 0 | } |
3157 | |
} |
3158 | |
} |
3159 | |
|
3160 | 70 | if ( tagletArtifact != null ) |
3161 | |
{ |
3162 | 2 | tArtifacts.add( tagletArtifact ); |
3163 | |
} |
3164 | |
|
3165 | 70 | if ( tagletArtifacts != null && tagletArtifacts.length > 0 ) |
3166 | |
{ |
3167 | 2 | tArtifacts.addAll( Arrays.asList( tagletArtifacts ) ); |
3168 | |
} |
3169 | |
|
3170 | 70 | return tArtifacts; |
3171 | |
} |
3172 | |
|
3173 | |
private Set<DocletArtifact> collectDocletArtifacts() |
3174 | |
throws MavenReportException |
3175 | |
{ |
3176 | 4 | Set<DocletArtifact> dArtifacts = new LinkedHashSet<DocletArtifact>(); |
3177 | |
|
3178 | 4 | if ( includeDependencySources ) |
3179 | |
{ |
3180 | |
try |
3181 | |
{ |
3182 | 0 | resolveDependencyBundles(); |
3183 | |
} |
3184 | 0 | catch ( IOException e ) |
3185 | |
{ |
3186 | 0 | throw new MavenReportException( |
3187 | |
"Failed to resolve javadoc bundles from dependencies: " + e.getMessage(), e ); |
3188 | 0 | } |
3189 | |
|
3190 | 0 | if ( isNotEmpty( dependencyJavadocBundles ) ) |
3191 | |
{ |
3192 | 0 | for ( JavadocBundle bundle : dependencyJavadocBundles ) |
3193 | |
{ |
3194 | 0 | JavadocOptions options = bundle.getOptions(); |
3195 | 0 | if ( options != null && isNotEmpty( options.getDocletArtifacts() ) ) |
3196 | |
{ |
3197 | 0 | dArtifacts.addAll( options.getDocletArtifacts() ); |
3198 | |
} |
3199 | 0 | } |
3200 | |
} |
3201 | |
} |
3202 | |
|
3203 | 4 | if ( docletArtifact != null ) |
3204 | |
{ |
3205 | 2 | dArtifacts.add( docletArtifact ); |
3206 | |
} |
3207 | |
|
3208 | 4 | if ( docletArtifacts != null && docletArtifacts.length > 0 ) |
3209 | |
{ |
3210 | 2 | dArtifacts.addAll( Arrays.asList( docletArtifacts ) ); |
3211 | |
} |
3212 | |
|
3213 | 4 | return dArtifacts; |
3214 | |
} |
3215 | |
|
3216 | |
private Set<Taglet> collectTaglets() |
3217 | |
throws MavenReportException |
3218 | |
{ |
3219 | 70 | Set<Taglet> result = new LinkedHashSet<Taglet>(); |
3220 | |
|
3221 | 70 | if ( includeDependencySources ) |
3222 | |
{ |
3223 | |
try |
3224 | |
{ |
3225 | 0 | resolveDependencyBundles(); |
3226 | |
} |
3227 | 0 | catch ( IOException e ) |
3228 | |
{ |
3229 | 0 | throw new MavenReportException( |
3230 | |
"Failed to resolve javadoc bundles from dependencies: " + e.getMessage(), e ); |
3231 | 0 | } |
3232 | |
|
3233 | 0 | if ( isNotEmpty( dependencyJavadocBundles ) ) |
3234 | |
{ |
3235 | 0 | for ( JavadocBundle bundle : dependencyJavadocBundles ) |
3236 | |
{ |
3237 | 0 | JavadocOptions options = bundle.getOptions(); |
3238 | 0 | if ( options != null && isNotEmpty( options.getTaglets() ) ) |
3239 | |
{ |
3240 | 0 | result.addAll( options.getTaglets() ); |
3241 | |
} |
3242 | 0 | } |
3243 | |
} |
3244 | |
} |
3245 | |
|
3246 | 70 | if ( taglets != null && taglets.length > 0 ) |
3247 | |
{ |
3248 | 0 | result.addAll( Arrays.asList( taglets ) ); |
3249 | |
} |
3250 | |
|
3251 | 70 | return result; |
3252 | |
} |
3253 | |
|
3254 | |
|
3255 | |
|
3256 | |
|
3257 | |
|
3258 | |
|
3259 | |
|
3260 | |
|
3261 | |
private List<String> getArtifactsAbsolutePath( JavadocPathArtifact javadocArtifact ) |
3262 | |
throws MavenReportException |
3263 | |
{ |
3264 | 12 | if ( ( StringUtils.isEmpty( javadocArtifact.getGroupId() ) ) && ( StringUtils.isEmpty( |
3265 | |
javadocArtifact.getArtifactId() ) ) && ( StringUtils.isEmpty( javadocArtifact.getVersion() ) ) ) |
3266 | |
{ |
3267 | 0 | return Collections.emptyList(); |
3268 | |
} |
3269 | |
|
3270 | 12 | List<String> path = new ArrayList<String>(); |
3271 | |
|
3272 | |
try |
3273 | |
{ |
3274 | 12 | Artifact artifact = createAndResolveArtifact( javadocArtifact ); |
3275 | 12 | path.add( artifact.getFile().getAbsolutePath() ); |
3276 | |
|
3277 | |
|
3278 | 12 | MavenProject artifactProject = |
3279 | |
mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories, localRepository ); |
3280 | 12 | Set<Artifact> dependencyArtifacts = artifactProject.createArtifacts( factory, null, null ); |
3281 | 12 | if ( !dependencyArtifacts.isEmpty() ) |
3282 | |
{ |
3283 | 4 | ArtifactResolutionResult result = |
3284 | |
resolver.resolveTransitively( dependencyArtifacts, artifactProject.getArtifact(), |
3285 | |
artifactProject.getRemoteArtifactRepositories(), localRepository, |
3286 | |
artifactMetadataSource ); |
3287 | 4 | Set<Artifact> artifacts = result.getArtifacts(); |
3288 | |
|
3289 | 4 | Map<String, Artifact> compileArtifactMap = new HashMap<String, Artifact>(); |
3290 | 4 | populateCompileArtifactMap( compileArtifactMap, artifacts ); |
3291 | |
|
3292 | 4 | for ( Artifact a : compileArtifactMap.values() ) |
3293 | |
{ |
3294 | 176 | path.add( a.getFile().getAbsolutePath() ); |
3295 | |
} |
3296 | |
} |
3297 | |
|
3298 | 12 | return path; |
3299 | |
} |
3300 | 0 | catch ( ArtifactResolutionException e ) |
3301 | |
{ |
3302 | 0 | throw new MavenReportException( "Unable to resolve artifact:" + javadocArtifact, e ); |
3303 | |
} |
3304 | 0 | catch ( ArtifactNotFoundException e ) |
3305 | |
{ |
3306 | 0 | throw new MavenReportException( "Unable to find artifact:" + javadocArtifact, e ); |
3307 | |
} |
3308 | 0 | catch ( ProjectBuildingException e ) |
3309 | |
{ |
3310 | 0 | throw new MavenReportException( "Unable to build the Maven project for the artifact:" + javadocArtifact, |
3311 | |
e ); |
3312 | |
} |
3313 | 0 | catch ( InvalidDependencyVersionException e ) |
3314 | |
{ |
3315 | 0 | throw new MavenReportException( "Unable to resolve artifact:" + javadocArtifact, e ); |
3316 | |
} |
3317 | |
} |
3318 | |
|
3319 | |
|
3320 | |
|
3321 | |
|
3322 | |
|
3323 | |
|
3324 | |
|
3325 | |
|
3326 | |
|
3327 | |
|
3328 | |
private Artifact createAndResolveArtifact( JavadocPathArtifact javadocArtifact ) |
3329 | |
throws ArtifactResolutionException, ArtifactNotFoundException, ProjectBuildingException |
3330 | |
{ |
3331 | 20 | Artifact artifact = |
3332 | |
factory.createProjectArtifact( javadocArtifact.getGroupId(), javadocArtifact.getArtifactId(), |
3333 | |
javadocArtifact.getVersion(), Artifact.SCOPE_COMPILE ); |
3334 | |
|
3335 | 20 | if ( artifact.getFile() == null ) |
3336 | |
{ |
3337 | 20 | MavenProject pluginProject = |
3338 | |
mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories, localRepository ); |
3339 | 20 | artifact = pluginProject.getArtifact(); |
3340 | |
|
3341 | 20 | resolver.resolve( artifact, remoteRepositories, localRepository ); |
3342 | |
} |
3343 | |
|
3344 | 20 | return artifact; |
3345 | |
} |
3346 | |
|
3347 | |
|
3348 | |
|
3349 | |
|
3350 | |
|
3351 | |
|
3352 | |
|
3353 | |
|
3354 | |
|
3355 | |
private void addMemoryArg( Commandline cmd, String arg, String memory ) |
3356 | |
{ |
3357 | 172 | if ( StringUtils.isNotEmpty( memory ) ) |
3358 | |
{ |
3359 | |
try |
3360 | |
{ |
3361 | 4 | cmd.createArg().setValue( "-J" + arg + JavadocUtil.parseJavadocMemory( memory ) ); |
3362 | |
} |
3363 | 0 | catch ( IllegalArgumentException e ) |
3364 | |
{ |
3365 | 0 | if ( getLog().isErrorEnabled() ) |
3366 | |
{ |
3367 | 0 | getLog().error( "Malformed memory pattern for '" + arg + memory + "'. Ignore this option." ); |
3368 | |
} |
3369 | 4 | } |
3370 | |
} |
3371 | 172 | } |
3372 | |
|
3373 | |
|
3374 | |
|
3375 | |
|
3376 | |
|
3377 | |
|
3378 | |
private void addProxyArg( Commandline cmd ) |
3379 | |
{ |
3380 | |
|
3381 | 86 | if ( StringUtils.isNotEmpty( proxyHost ) ) |
3382 | |
{ |
3383 | 0 | if ( getLog().isWarnEnabled() ) |
3384 | |
{ |
3385 | 0 | getLog().warn( "The Javadoc plugin parameter 'proxyHost' is deprecated since 2.4. " |
3386 | |
+ "Please configure an active proxy in your settings.xml." ); |
3387 | |
} |
3388 | 0 | cmd.createArg().setValue( "-J-DproxyHost=" + proxyHost ); |
3389 | |
|
3390 | 0 | if ( proxyPort > 0 ) |
3391 | |
{ |
3392 | 0 | if ( getLog().isWarnEnabled() ) |
3393 | |
{ |
3394 | 0 | getLog().warn( "The Javadoc plugin parameter 'proxyPort' is deprecated since 2.4. " |
3395 | |
+ "Please configure an active proxy in your settings.xml." ); |
3396 | |
} |
3397 | 0 | cmd.createArg().setValue( "-J-DproxyPort=" + proxyPort ); |
3398 | |
} |
3399 | |
} |
3400 | |
|
3401 | 86 | if ( settings == null || settings.getActiveProxy() == null ) |
3402 | |
{ |
3403 | 80 | return; |
3404 | |
} |
3405 | |
|
3406 | 6 | Proxy activeProxy = settings.getActiveProxy(); |
3407 | 6 | String protocol = StringUtils.isNotEmpty( activeProxy.getProtocol() ) ? activeProxy.getProtocol() + "." : ""; |
3408 | |
|
3409 | 6 | if ( StringUtils.isNotEmpty( activeProxy.getHost() ) ) |
3410 | |
{ |
3411 | 6 | cmd.createArg().setValue( "-J-D" + protocol + "proxySet=true" ); |
3412 | 6 | cmd.createArg().setValue( "-J-D" + protocol + "proxyHost=" + activeProxy.getHost() ); |
3413 | |
|
3414 | 6 | if ( activeProxy.getPort() > 0 ) |
3415 | |
{ |
3416 | 6 | cmd.createArg().setValue( "-J-D" + protocol + "proxyPort=" + activeProxy.getPort() ); |
3417 | |
} |
3418 | |
|
3419 | 6 | if ( StringUtils.isNotEmpty( activeProxy.getNonProxyHosts() ) ) |
3420 | |
{ |
3421 | 2 | cmd.createArg().setValue( |
3422 | |
"-J-D" + protocol + "nonProxyHosts=\"" + activeProxy.getNonProxyHosts() + "\"" ); |
3423 | |
} |
3424 | |
|
3425 | 6 | if ( StringUtils.isNotEmpty( activeProxy.getUsername() ) ) |
3426 | |
{ |
3427 | 4 | cmd.createArg().setValue( "-J-Dhttp.proxyUser=\"" + activeProxy.getUsername() + "\"" ); |
3428 | |
|
3429 | 4 | if ( StringUtils.isNotEmpty( activeProxy.getPassword() ) ) |
3430 | |
{ |
3431 | 4 | cmd.createArg().setValue( "-J-Dhttp.proxyPassword=\"" + activeProxy.getPassword() + "\"" ); |
3432 | |
} |
3433 | |
} |
3434 | |
} |
3435 | 6 | } |
3436 | |
|
3437 | |
|
3438 | |
|
3439 | |
|
3440 | |
|
3441 | |
|
3442 | |
|
3443 | |
|
3444 | |
private String getJavadocExecutable() |
3445 | |
throws IOException |
3446 | |
{ |
3447 | 86 | Toolchain tc = getToolchain(); |
3448 | |
|
3449 | 86 | if ( tc != null ) |
3450 | |
{ |
3451 | 0 | getLog().info( "Toolchain in javadoc-plugin: " + tc ); |
3452 | 0 | if ( javadocExecutable != null ) |
3453 | |
{ |
3454 | 0 | getLog().warn( "Toolchains are ignored, 'javadocExecutable' parameter is set to " + javadocExecutable ); |
3455 | |
} |
3456 | |
else |
3457 | |
{ |
3458 | 0 | javadocExecutable = tc.findTool( "javadoc" ); |
3459 | |
} |
3460 | |
} |
3461 | |
|
3462 | 86 | String javadocCommand = "javadoc" + ( SystemUtils.IS_OS_WINDOWS ? ".exe" : "" ); |
3463 | |
|
3464 | |
File javadocExe; |
3465 | |
|
3466 | |
|
3467 | |
|
3468 | |
|
3469 | 86 | if ( StringUtils.isNotEmpty( javadocExecutable ) ) |
3470 | |
{ |
3471 | 0 | javadocExe = new File( javadocExecutable ); |
3472 | |
|
3473 | 0 | if ( javadocExe.isDirectory() ) |
3474 | |
{ |
3475 | 0 | javadocExe = new File( javadocExe, javadocCommand ); |
3476 | |
} |
3477 | |
|
3478 | 0 | if ( SystemUtils.IS_OS_WINDOWS && javadocExe.getName().indexOf( '.' ) < 0 ) |
3479 | |
{ |
3480 | 0 | javadocExe = new File( javadocExe.getPath() + ".exe" ); |
3481 | |
} |
3482 | |
|
3483 | 0 | if ( !javadocExe.isFile() ) |
3484 | |
{ |
3485 | 0 | throw new IOException( "The javadoc executable '" + javadocExe |
3486 | |
+ "' doesn't exist or is not a file. Verify the <javadocExecutable/> parameter." ); |
3487 | |
} |
3488 | |
|
3489 | 0 | return javadocExe.getAbsolutePath(); |
3490 | |
} |
3491 | |
|
3492 | |
|
3493 | |
|
3494 | |
|
3495 | |
|
3496 | |
|
3497 | |
|
3498 | 86 | if ( SystemUtils.IS_OS_AIX ) |
3499 | |
{ |
3500 | 0 | javadocExe = |
3501 | |
new File( SystemUtils.getJavaHome() + File.separator + ".." + File.separator + "sh", javadocCommand ); |
3502 | |
} |
3503 | 86 | else if ( SystemUtils.IS_OS_MAC_OSX ) |
3504 | |
{ |
3505 | 86 | javadocExe = new File( SystemUtils.getJavaHome() + File.separator + "bin", javadocCommand ); |
3506 | |
} |
3507 | |
else |
3508 | |
{ |
3509 | 0 | javadocExe = |
3510 | |
new File( SystemUtils.getJavaHome() + File.separator + ".." + File.separator + "bin", javadocCommand ); |
3511 | |
} |
3512 | |
|
3513 | |
|
3514 | |
|
3515 | |
|
3516 | 86 | if ( !javadocExe.exists() || !javadocExe.isFile() ) |
3517 | |
{ |
3518 | 2 | Properties env = CommandLineUtils.getSystemEnvVars(); |
3519 | 2 | String javaHome = env.getProperty( "JAVA_HOME" ); |
3520 | 2 | if ( StringUtils.isEmpty( javaHome ) ) |
3521 | |
{ |
3522 | 0 | throw new IOException( "The environment variable JAVA_HOME is not correctly set." ); |
3523 | |
} |
3524 | 2 | if ( ( !new File( javaHome ).exists() ) || ( !new File( javaHome ).isDirectory() ) ) |
3525 | |
{ |
3526 | 0 | throw new IOException( |
3527 | |
"The environment variable JAVA_HOME=" + javaHome + " doesn't exist or is not a valid directory." ); |
3528 | |
} |
3529 | |
|
3530 | 2 | javadocExe = new File( env.getProperty( "JAVA_HOME" ) + File.separator + "bin", javadocCommand ); |
3531 | |
} |
3532 | |
|
3533 | 86 | if ( !javadocExe.exists() || !javadocExe.isFile() ) |
3534 | |
{ |
3535 | 0 | throw new IOException( "The javadoc executable '" + javadocExe |
3536 | |
+ "' doesn't exist or is not a file. Verify the JAVA_HOME environment variable." ); |
3537 | |
} |
3538 | |
|
3539 | 86 | return javadocExe.getAbsolutePath(); |
3540 | |
} |
3541 | |
|
3542 | |
|
3543 | |
|
3544 | |
|
3545 | |
|
3546 | |
|
3547 | |
|
3548 | |
|
3549 | |
private void setFJavadocVersion( File jExecutable ) |
3550 | |
throws MavenReportException |
3551 | |
{ |
3552 | |
float jVersion; |
3553 | |
try |
3554 | |
{ |
3555 | 86 | jVersion = JavadocUtil.getJavadocVersion( jExecutable ); |
3556 | |
} |
3557 | 0 | catch ( IOException e ) |
3558 | |
{ |
3559 | 0 | if ( getLog().isWarnEnabled() ) |
3560 | |
{ |
3561 | 0 | getLog().warn( "Unable to find the javadoc version: " + e.getMessage() ); |
3562 | 0 | getLog().warn( "Using the Java version instead of, i.e. " + SystemUtils.JAVA_VERSION_FLOAT ); |
3563 | |
} |
3564 | 0 | jVersion = SystemUtils.JAVA_VERSION_FLOAT; |
3565 | |
} |
3566 | 0 | catch ( CommandLineException e ) |
3567 | |
{ |
3568 | 0 | if ( getLog().isWarnEnabled() ) |
3569 | |
{ |
3570 | 0 | getLog().warn( "Unable to find the javadoc version: " + e.getMessage() ); |
3571 | 0 | getLog().warn( "Using the Java the version instead of, i.e. " + SystemUtils.JAVA_VERSION_FLOAT ); |
3572 | |
} |
3573 | 0 | jVersion = SystemUtils.JAVA_VERSION_FLOAT; |
3574 | |
} |
3575 | 0 | catch ( IllegalArgumentException e ) |
3576 | |
{ |
3577 | 0 | if ( getLog().isWarnEnabled() ) |
3578 | |
{ |
3579 | 0 | getLog().warn( "Unable to find the javadoc version: " + e.getMessage() ); |
3580 | 0 | getLog().warn( "Using the Java the version instead of, i.e. " + SystemUtils.JAVA_VERSION_FLOAT ); |
3581 | |
} |
3582 | 0 | jVersion = SystemUtils.JAVA_VERSION_FLOAT; |
3583 | 86 | } |
3584 | |
|
3585 | 86 | if ( StringUtils.isNotEmpty( javadocVersion ) ) |
3586 | |
{ |
3587 | |
try |
3588 | |
{ |
3589 | 0 | fJavadocVersion = Float.parseFloat( javadocVersion ); |
3590 | |
} |
3591 | 0 | catch ( NumberFormatException e ) |
3592 | |
{ |
3593 | 0 | throw new MavenReportException( "Unable to parse javadoc version: " + e.getMessage(), e ); |
3594 | 0 | } |
3595 | |
|
3596 | 0 | if ( fJavadocVersion != jVersion && getLog().isWarnEnabled() ) |
3597 | |
{ |
3598 | 0 | getLog().warn( "Are you sure about the <javadocVersion/> parameter? It seems to be " + jVersion ); |
3599 | |
} |
3600 | |
} |
3601 | |
else |
3602 | |
{ |
3603 | 86 | fJavadocVersion = jVersion; |
3604 | |
} |
3605 | 86 | } |
3606 | |
|
3607 | |
|
3608 | |
|
3609 | |
|
3610 | |
|
3611 | |
|
3612 | |
|
3613 | |
|
3614 | |
private boolean isJavaDocVersionAtLeast( float requiredVersion ) |
3615 | |
{ |
3616 | 502 | return fJavadocVersion >= requiredVersion; |
3617 | |
} |
3618 | |
|
3619 | |
|
3620 | |
|
3621 | |
|
3622 | |
|
3623 | |
|
3624 | |
|
3625 | |
|
3626 | |
|
3627 | |
private void addArgIf( List<String> arguments, boolean b, String value ) |
3628 | |
{ |
3629 | 1164 | if ( b ) |
3630 | |
{ |
3631 | 228 | arguments.add( value ); |
3632 | |
} |
3633 | 1164 | } |
3634 | |
|
3635 | |
|
3636 | |
|
3637 | |
|
3638 | |
|
3639 | |
|
3640 | |
|
3641 | |
|
3642 | |
|
3643 | |
|
3644 | |
|
3645 | |
|
3646 | |
private void addArgIf( List<String> arguments, boolean b, String value, float requiredJavaVersion ) |
3647 | |
{ |
3648 | 514 | if ( b ) |
3649 | |
{ |
3650 | 92 | if ( isJavaDocVersionAtLeast( requiredJavaVersion ) ) |
3651 | |
{ |
3652 | 92 | addArgIf( arguments, b, value ); |
3653 | |
} |
3654 | |
else |
3655 | |
{ |
3656 | 0 | if ( getLog().isWarnEnabled() ) |
3657 | |
{ |
3658 | 0 | getLog().warn( value + " option is not supported on Java version < " + requiredJavaVersion |
3659 | |
+ ". Ignore this option." ); |
3660 | |
} |
3661 | |
} |
3662 | |
} |
3663 | 514 | } |
3664 | |
|
3665 | |
|
3666 | |
|
3667 | |
|
3668 | |
|
3669 | |
|
3670 | |
|
3671 | |
|
3672 | |
|
3673 | |
|
3674 | |
|
3675 | |
|
3676 | |
private void addArgIfNotEmpty( List<String> arguments, String key, String value ) |
3677 | |
{ |
3678 | 932 | addArgIfNotEmpty( arguments, key, value, false ); |
3679 | 932 | } |
3680 | |
|
3681 | |
|
3682 | |
|
3683 | |
|
3684 | |
|
3685 | |
|
3686 | |
|
3687 | |
|
3688 | |
|
3689 | |
|
3690 | |
|
3691 | |
|
3692 | |
|
3693 | |
|
3694 | |
|
3695 | |
|
3696 | |
private void addArgIfNotEmpty( List<String> arguments, String key, String value, boolean repeatKey, |
3697 | |
boolean splitValue, float requiredJavaVersion ) |
3698 | |
{ |
3699 | 70 | if ( StringUtils.isNotEmpty( value ) ) |
3700 | |
{ |
3701 | 2 | if ( isJavaDocVersionAtLeast( requiredJavaVersion ) ) |
3702 | |
{ |
3703 | 2 | addArgIfNotEmpty( arguments, key, value, repeatKey, splitValue ); |
3704 | |
} |
3705 | |
else |
3706 | |
{ |
3707 | 0 | if ( getLog().isWarnEnabled() ) |
3708 | |
{ |
3709 | 0 | getLog().warn( key + " option is not supported on Java version < " + requiredJavaVersion |
3710 | |
+ ". Ignore this option." ); |
3711 | |
} |
3712 | |
} |
3713 | |
} |
3714 | 70 | } |
3715 | |
|
3716 | |
|
3717 | |
|
3718 | |
|
3719 | |
|
3720 | |
|
3721 | |
|
3722 | |
|
3723 | |
|
3724 | |
|
3725 | |
|
3726 | |
|
3727 | |
|
3728 | |
private void addArgIfNotEmpty( List<String> arguments, String key, String value, boolean repeatKey, |
3729 | |
boolean splitValue ) |
3730 | |
{ |
3731 | 1366 | if ( StringUtils.isNotEmpty( value ) ) |
3732 | |
{ |
3733 | 578 | if ( StringUtils.isNotEmpty( key ) ) |
3734 | |
{ |
3735 | 578 | arguments.add( key ); |
3736 | |
} |
3737 | |
|
3738 | 578 | if ( splitValue ) |
3739 | |
{ |
3740 | 484 | StringTokenizer token = new StringTokenizer( value, "," ); |
3741 | 968 | while ( token.hasMoreTokens() ) |
3742 | |
{ |
3743 | 484 | String current = token.nextToken().trim(); |
3744 | |
|
3745 | 484 | if ( StringUtils.isNotEmpty( current ) ) |
3746 | |
{ |
3747 | 484 | arguments.add( current ); |
3748 | |
|
3749 | 484 | if ( token.hasMoreTokens() && repeatKey ) |
3750 | |
{ |
3751 | 0 | arguments.add( key ); |
3752 | |
} |
3753 | |
} |
3754 | 484 | } |
3755 | 484 | } |
3756 | |
else |
3757 | |
{ |
3758 | 94 | arguments.add( value ); |
3759 | |
} |
3760 | |
} |
3761 | 1366 | } |
3762 | |
|
3763 | |
|
3764 | |
|
3765 | |
|
3766 | |
|
3767 | |
|
3768 | |
|
3769 | |
|
3770 | |
|
3771 | |
|
3772 | |
|
3773 | |
|
3774 | |
private void addArgIfNotEmpty( List<String> arguments, String key, String value, boolean repeatKey ) |
3775 | |
{ |
3776 | 1012 | addArgIfNotEmpty( arguments, key, value, repeatKey, true ); |
3777 | 1012 | } |
3778 | |
|
3779 | |
|
3780 | |
|
3781 | |
|
3782 | |
|
3783 | |
|
3784 | |
|
3785 | |
|
3786 | |
|
3787 | |
|
3788 | |
|
3789 | |
private void addArgIfNotEmpty( List<String> arguments, String key, String value, float requiredJavaVersion ) |
3790 | |
{ |
3791 | 510 | addArgIfNotEmpty( arguments, key, value, requiredJavaVersion, false ); |
3792 | 510 | } |
3793 | |
|
3794 | |
|
3795 | |
|
3796 | |
|
3797 | |
|
3798 | |
|
3799 | |
|
3800 | |
|
3801 | |
|
3802 | |
|
3803 | |
|
3804 | |
|
3805 | |
|
3806 | |
private void addArgIfNotEmpty( List<String> arguments, String key, String value, float requiredJavaVersion, |
3807 | |
boolean repeatKey ) |
3808 | |
{ |
3809 | 510 | if ( StringUtils.isNotEmpty( value ) ) |
3810 | |
{ |
3811 | 72 | if ( isJavaDocVersionAtLeast( requiredJavaVersion ) ) |
3812 | |
{ |
3813 | 72 | addArgIfNotEmpty( arguments, key, value, repeatKey ); |
3814 | |
} |
3815 | |
else |
3816 | |
{ |
3817 | 0 | if ( getLog().isWarnEnabled() ) |
3818 | |
{ |
3819 | 0 | getLog().warn( key + " option is not supported on Java version < " + requiredJavaVersion ); |
3820 | |
} |
3821 | |
} |
3822 | |
} |
3823 | 510 | } |
3824 | |
|
3825 | |
|
3826 | |
|
3827 | |
|
3828 | |
|
3829 | |
|
3830 | |
|
3831 | |
|
3832 | |
|
3833 | |
|
3834 | |
|
3835 | |
|
3836 | |
|
3837 | |
|
3838 | |
private void addLinkofflineArguments( List<String> arguments ) |
3839 | |
throws MavenReportException |
3840 | |
{ |
3841 | 70 | Set<OfflineLink> offlineLinksList = collectOfflineLinks(); |
3842 | |
|
3843 | 70 | offlineLinksList.addAll( getModulesLinks() ); |
3844 | |
|
3845 | 70 | for ( OfflineLink offlineLink : offlineLinksList ) |
3846 | |
{ |
3847 | 4 | String url = offlineLink.getUrl(); |
3848 | 4 | if ( StringUtils.isEmpty( url ) ) |
3849 | |
{ |
3850 | 0 | continue; |
3851 | |
} |
3852 | 4 | url = cleanUrl( url ); |
3853 | |
|
3854 | 4 | String location = offlineLink.getLocation(); |
3855 | 4 | if ( StringUtils.isEmpty( location ) ) |
3856 | |
{ |
3857 | 0 | continue; |
3858 | |
} |
3859 | 4 | if ( isValidJavadocLink( location ) ) |
3860 | |
{ |
3861 | 4 | addArgIfNotEmpty( arguments, "-linkoffline", |
3862 | |
JavadocUtil.quotedPathArgument( url ) + " " + JavadocUtil.quotedPathArgument( |
3863 | |
location ), true ); |
3864 | |
} |
3865 | 4 | } |
3866 | 70 | } |
3867 | |
|
3868 | |
|
3869 | |
|
3870 | |
|
3871 | |
|
3872 | |
|
3873 | |
|
3874 | |
|
3875 | |
|
3876 | |
|
3877 | |
|
3878 | |
|
3879 | |
|
3880 | |
|
3881 | |
|
3882 | |
|
3883 | |
|
3884 | |
|
3885 | |
|
3886 | |
|
3887 | |
private void addLinkArguments( List<String> arguments ) |
3888 | |
throws MavenReportException |
3889 | |
{ |
3890 | 68 | Set<String> links = collectLinks(); |
3891 | |
|
3892 | 68 | for ( String link : links ) |
3893 | |
{ |
3894 | 2 | if ( StringUtils.isEmpty( link ) ) |
3895 | |
{ |
3896 | 0 | continue; |
3897 | |
} |
3898 | |
|
3899 | 2 | while ( link.endsWith( "/" ) ) |
3900 | |
{ |
3901 | 0 | link = link.substring( 0, link.lastIndexOf( "/" ) ); |
3902 | |
} |
3903 | |
|
3904 | 2 | addArgIfNotEmpty( arguments, "-link", JavadocUtil.quotedPathArgument( link ), true, false ); |
3905 | |
} |
3906 | 68 | } |
3907 | |
|
3908 | |
|
3909 | |
|
3910 | |
|
3911 | |
|
3912 | |
|
3913 | |
|
3914 | |
|
3915 | |
|
3916 | |
|
3917 | |
private void copyAllResources( File javadocOutputDirectory ) |
3918 | |
throws MavenReportException |
3919 | |
{ |
3920 | |
|
3921 | |
|
3922 | |
|
3923 | |
|
3924 | |
try |
3925 | |
{ |
3926 | 86 | copyDefaultStylesheet( javadocOutputDirectory ); |
3927 | |
} |
3928 | 0 | catch ( IOException e ) |
3929 | |
{ |
3930 | 0 | throw new MavenReportException( "Unable to copy default stylesheet: " + e.getMessage(), e ); |
3931 | 86 | } |
3932 | |
|
3933 | |
|
3934 | |
|
3935 | |
|
3936 | |
|
3937 | 86 | if ( docfilessubdirs ) |
3938 | |
{ |
3939 | |
|
3940 | |
|
3941 | |
|
3942 | |
|
3943 | |
try |
3944 | |
{ |
3945 | 10 | copyJavadocResources( javadocOutputDirectory ); |
3946 | |
} |
3947 | 0 | catch ( IOException e ) |
3948 | |
{ |
3949 | 0 | throw new MavenReportException( "Unable to copy javadoc resources: " + e.getMessage(), e ); |
3950 | 10 | } |
3951 | |
} |
3952 | |
|
3953 | |
|
3954 | |
|
3955 | |
|
3956 | |
|
3957 | 86 | copyAdditionalJavadocResources( javadocOutputDirectory ); |
3958 | 86 | } |
3959 | |
|
3960 | |
|
3961 | |
|
3962 | |
|
3963 | |
|
3964 | |
|
3965 | |
|
3966 | |
|
3967 | |
|
3968 | |
|
3969 | |
|
3970 | |
private void copyDefaultStylesheet( File anOutputDirectory ) |
3971 | |
throws IOException |
3972 | |
{ |
3973 | 86 | if ( StringUtils.isNotEmpty( stylesheetfile ) ) |
3974 | |
{ |
3975 | 6 | return; |
3976 | |
} |
3977 | |
|
3978 | 80 | if ( !stylesheet.equalsIgnoreCase( "maven" ) ) |
3979 | |
{ |
3980 | 76 | return; |
3981 | |
} |
3982 | |
|
3983 | 4 | URL url = getClass().getClassLoader().getResource( RESOURCE_CSS_DIR + "/" + DEFAULT_CSS_NAME ); |
3984 | 4 | File outFile = new File( anOutputDirectory, DEFAULT_CSS_NAME ); |
3985 | 4 | JavadocUtil.copyResource( url, outFile ); |
3986 | 4 | } |
3987 | |
|
3988 | |
|
3989 | |
|
3990 | |
|
3991 | |
|
3992 | |
|
3993 | |
|
3994 | |
|
3995 | |
|
3996 | |
|
3997 | |
|
3998 | |
private void copyJavadocResources( File anOutputDirectory ) |
3999 | |
throws IOException |
4000 | |
{ |
4001 | 10 | if ( anOutputDirectory == null || !anOutputDirectory.exists() ) |
4002 | |
{ |
4003 | 0 | throw new IOException( "The outputDirectory " + anOutputDirectory + " doesn't exists." ); |
4004 | |
} |
4005 | |
|
4006 | 10 | if ( includeDependencySources ) |
4007 | |
{ |
4008 | 0 | resolveDependencyBundles(); |
4009 | 0 | if ( isNotEmpty( dependencyJavadocBundles ) ) |
4010 | |
{ |
4011 | 0 | for ( JavadocBundle bundle : dependencyJavadocBundles ) |
4012 | |
{ |
4013 | 0 | File dir = bundle.getResourcesDirectory(); |
4014 | 0 | JavadocOptions options = bundle.getOptions(); |
4015 | 0 | if ( dir != null && dir.isDirectory() ) |
4016 | |
{ |
4017 | 0 | JavadocUtil.copyJavadocResources( anOutputDirectory, dir, options == null |
4018 | |
? null |
4019 | |
: options.getExcludedDocfilesSubdirs() ); |
4020 | |
} |
4021 | 0 | } |
4022 | |
} |
4023 | |
} |
4024 | |
|
4025 | 10 | if ( getJavadocDirectory() != null ) |
4026 | |
{ |
4027 | 8 | JavadocUtil.copyJavadocResources( anOutputDirectory, getJavadocDirectory(), excludedocfilessubdir ); |
4028 | |
} |
4029 | |
|
4030 | 10 | if ( isAggregator() && project.isExecutionRoot() ) |
4031 | |
{ |
4032 | 2 | for ( MavenProject subProject : reactorProjects ) |
4033 | |
{ |
4034 | 4 | if ( subProject != project && getJavadocDirectory() != null ) |
4035 | |
{ |
4036 | 4 | String javadocDirRelative = |
4037 | |
PathUtils.toRelative( project.getBasedir(), getJavadocDirectory().getAbsolutePath() ); |
4038 | 4 | File javadocDir = new File( subProject.getBasedir(), javadocDirRelative ); |
4039 | 4 | JavadocUtil.copyJavadocResources( anOutputDirectory, javadocDir, excludedocfilessubdir ); |
4040 | 4 | } |
4041 | |
} |
4042 | |
} |
4043 | 10 | } |
4044 | |
|
4045 | |
private synchronized void resolveDependencyBundles() |
4046 | |
throws IOException |
4047 | |
{ |
4048 | 0 | if ( dependencyJavadocBundles == null ) |
4049 | |
{ |
4050 | 0 | dependencyJavadocBundles = |
4051 | |
ResourceResolver.resolveDependencyJavadocBundles( getDependencySourceResolverConfig() ); |
4052 | 0 | if ( dependencyJavadocBundles == null ) |
4053 | |
{ |
4054 | 0 | dependencyJavadocBundles = new ArrayList<JavadocBundle>(); |
4055 | |
} |
4056 | |
} |
4057 | 0 | } |
4058 | |
|
4059 | |
|
4060 | |
|
4061 | |
|
4062 | |
|
4063 | |
|
4064 | |
|
4065 | |
|
4066 | |
private void copyAdditionalJavadocResources( File anOutputDirectory ) |
4067 | |
throws MavenReportException |
4068 | |
{ |
4069 | 86 | Set<ResourcesArtifact> resourcesArtifacts = collectResourcesArtifacts(); |
4070 | 86 | if ( isEmpty( resourcesArtifacts ) ) |
4071 | |
{ |
4072 | 86 | return; |
4073 | |
} |
4074 | |
|
4075 | |
UnArchiver unArchiver; |
4076 | |
try |
4077 | |
{ |
4078 | 0 | unArchiver = archiverManager.getUnArchiver( "jar" ); |
4079 | |
} |
4080 | 0 | catch ( NoSuchArchiverException e ) |
4081 | |
{ |
4082 | 0 | throw new MavenReportException( |
4083 | |
"Unable to extract resources artifact. " + "No archiver for 'jar' available.", e ); |
4084 | 0 | } |
4085 | |
|
4086 | 0 | for ( ResourcesArtifact item : resourcesArtifacts ) |
4087 | |
{ |
4088 | |
Artifact artifact; |
4089 | |
try |
4090 | |
{ |
4091 | 0 | artifact = createAndResolveArtifact( item ); |
4092 | |
} |
4093 | 0 | catch ( ArtifactResolutionException e ) |
4094 | |
{ |
4095 | 0 | throw new MavenReportException( "Unable to resolve artifact:" + item, e ); |
4096 | |
} |
4097 | 0 | catch ( ArtifactNotFoundException e ) |
4098 | |
{ |
4099 | 0 | throw new MavenReportException( "Unable to find artifact:" + item, e ); |
4100 | |
} |
4101 | 0 | catch ( ProjectBuildingException e ) |
4102 | |
{ |
4103 | 0 | throw new MavenReportException( "Unable to build the Maven project for the artifact:" + item, e ); |
4104 | 0 | } |
4105 | |
|
4106 | 0 | unArchiver.setSourceFile( artifact.getFile() ); |
4107 | 0 | unArchiver.setDestDirectory( anOutputDirectory ); |
4108 | |
|
4109 | 0 | IncludeExcludeFileSelector[] selectors = |
4110 | |
new IncludeExcludeFileSelector[]{ new IncludeExcludeFileSelector() }; |
4111 | 0 | selectors[0].setExcludes( new String[]{ "META-INF/**" } ); |
4112 | 0 | unArchiver.setFileSelectors( selectors ); |
4113 | |
|
4114 | 0 | getLog().info( "Extracting contents of resources artifact: " + artifact.getArtifactId() ); |
4115 | |
try |
4116 | |
{ |
4117 | 0 | unArchiver.extract(); |
4118 | |
} |
4119 | 0 | catch ( ArchiverException e ) |
4120 | |
{ |
4121 | 0 | throw new MavenReportException( |
4122 | |
"Extraction of resources failed. Artifact that failed was: " + artifact.getArtifactId(), e ); |
4123 | 0 | } |
4124 | 0 | } |
4125 | 0 | } |
4126 | |
|
4127 | |
|
4128 | |
|
4129 | |
|
4130 | |
|
4131 | |
|
4132 | |
private List<String> getPackageNames( List<String> sourcePaths, List<String> files ) |
4133 | |
{ |
4134 | 86 | return getPackageNamesOrFilesWithUnnamedPackages( sourcePaths, files, true ); |
4135 | |
} |
4136 | |
|
4137 | |
|
4138 | |
|
4139 | |
|
4140 | |
|
4141 | |
|
4142 | |
private List<String> getFilesWithUnnamedPackages( List<String> sourcePaths, List<String> files ) |
4143 | |
{ |
4144 | 86 | return getPackageNamesOrFilesWithUnnamedPackages( sourcePaths, files, false ); |
4145 | |
} |
4146 | |
|
4147 | |
|
4148 | |
|
4149 | |
|
4150 | |
|
4151 | |
|
4152 | |
|
4153 | |
|
4154 | |
|
4155 | |
private List<String> getPackageNamesOrFilesWithUnnamedPackages( List<String> sourcePaths, List<String> files, |
4156 | |
boolean onlyPackageName ) |
4157 | |
{ |
4158 | 172 | List<String> returnList = new ArrayList<String>(); |
4159 | |
|
4160 | 172 | if ( !StringUtils.isEmpty( sourcepath ) ) |
4161 | |
{ |
4162 | 8 | return returnList; |
4163 | |
} |
4164 | |
|
4165 | 164 | for ( String currentFile : files ) |
4166 | |
{ |
4167 | 296 | currentFile = currentFile.replace( '\\', '/' ); |
4168 | |
|
4169 | 296 | for ( String currentSourcePath : sourcePaths ) |
4170 | |
{ |
4171 | 392 | currentSourcePath = currentSourcePath.replace( '\\', '/' ); |
4172 | |
|
4173 | 392 | if ( !currentSourcePath.endsWith( "/" ) ) |
4174 | |
{ |
4175 | 392 | currentSourcePath += "/"; |
4176 | |
} |
4177 | |
|
4178 | 392 | if ( currentFile.indexOf( currentSourcePath ) != -1 ) |
4179 | |
{ |
4180 | 288 | String packagename = currentFile.substring( currentSourcePath.length() + 1 ); |
4181 | |
|
4182 | |
|
4183 | |
|
4184 | |
|
4185 | |
|
4186 | 288 | if ( packagename.indexOf( "doc-files" ) != -1 ) |
4187 | |
{ |
4188 | 4 | continue; |
4189 | |
} |
4190 | |
|
4191 | 284 | if ( onlyPackageName && packagename.lastIndexOf( "/" ) != -1 ) |
4192 | |
{ |
4193 | 94 | packagename = packagename.substring( 0, packagename.lastIndexOf( "/" ) ); |
4194 | 94 | packagename = packagename.replace( '/', '.' ); |
4195 | |
|
4196 | 94 | if ( !returnList.contains( packagename ) ) |
4197 | |
{ |
4198 | 80 | returnList.add( packagename ); |
4199 | |
} |
4200 | |
} |
4201 | 284 | if ( !onlyPackageName && packagename.lastIndexOf( "/" ) == -1 ) |
4202 | |
{ |
4203 | 48 | returnList.add( currentFile ); |
4204 | |
} |
4205 | 388 | } |
4206 | |
} |
4207 | |
} |
4208 | |
|
4209 | 164 | return returnList; |
4210 | |
} |
4211 | |
|
4212 | |
|
4213 | |
|
4214 | |
|
4215 | |
|
4216 | |
|
4217 | |
|
4218 | |
|
4219 | |
|
4220 | |
|
4221 | |
|
4222 | |
|
4223 | |
|
4224 | |
private void addCommandLineOptions( Commandline cmd, List<String> arguments, File javadocOutputDirectory ) |
4225 | |
throws MavenReportException |
4226 | |
{ |
4227 | 74 | File optionsFile = new File( javadocOutputDirectory, OPTIONS_FILE_NAME ); |
4228 | |
|
4229 | 74 | StringBuilder options = new StringBuilder(); |
4230 | 74 | options.append( StringUtils.join( arguments.toArray( new String[0] ), SystemUtils.LINE_SEPARATOR ) ); |
4231 | |
|
4232 | |
try |
4233 | |
{ |
4234 | 74 | FileUtils.fileWrite( optionsFile.getAbsolutePath(), options.toString() ); |
4235 | |
} |
4236 | 0 | catch ( IOException e ) |
4237 | |
{ |
4238 | 0 | throw new MavenReportException( |
4239 | |
"Unable to write '" + optionsFile.getName() + "' temporary file for command execution", e ); |
4240 | 74 | } |
4241 | |
|
4242 | 74 | cmd.createArg().setValue( "@" + OPTIONS_FILE_NAME ); |
4243 | 74 | } |
4244 | |
|
4245 | |
|
4246 | |
|
4247 | |
|
4248 | |
|
4249 | |
|
4250 | |
|
4251 | |
|
4252 | |
|
4253 | |
|
4254 | |
|
4255 | |
|
4256 | |
|
4257 | |
|
4258 | |
|
4259 | |
|
4260 | |
|
4261 | |
|
4262 | |
|
4263 | |
private void addCommandLineArgFile( Commandline cmd, File javadocOutputDirectory, List<String> files ) |
4264 | |
throws MavenReportException |
4265 | |
{ |
4266 | |
File argfileFile; |
4267 | 22 | if ( isJavaDocVersionAtLeast( SINCE_JAVADOC_1_4 ) ) |
4268 | |
{ |
4269 | 22 | argfileFile = new File( javadocOutputDirectory, ARGFILE_FILE_NAME ); |
4270 | 22 | cmd.createArg().setValue( "@" + ARGFILE_FILE_NAME ); |
4271 | |
} |
4272 | |
else |
4273 | |
{ |
4274 | 0 | argfileFile = new File( javadocOutputDirectory, FILES_FILE_NAME ); |
4275 | 0 | cmd.createArg().setValue( "@" + FILES_FILE_NAME ); |
4276 | |
} |
4277 | |
|
4278 | |
try |
4279 | |
{ |
4280 | 22 | FileUtils.fileWrite( argfileFile.getAbsolutePath(), null , |
4281 | |
StringUtils.join( files.iterator(), SystemUtils.LINE_SEPARATOR ) ); |
4282 | |
} |
4283 | 0 | catch ( IOException e ) |
4284 | |
{ |
4285 | 0 | throw new MavenReportException( |
4286 | |
"Unable to write '" + argfileFile.getName() + "' temporary file for command execution", e ); |
4287 | 22 | } |
4288 | 22 | } |
4289 | |
|
4290 | |
|
4291 | |
|
4292 | |
|
4293 | |
|
4294 | |
|
4295 | |
|
4296 | |
|
4297 | |
|
4298 | |
|
4299 | |
|
4300 | |
|
4301 | |
|
4302 | |
private void addCommandLinePackages( Commandline cmd, File javadocOutputDirectory, List<String> packageNames ) |
4303 | |
throws MavenReportException |
4304 | |
{ |
4305 | 50 | File packagesFile = new File( javadocOutputDirectory, PACKAGES_FILE_NAME ); |
4306 | |
|
4307 | |
try |
4308 | |
{ |
4309 | 50 | FileUtils.fileWrite( packagesFile.getAbsolutePath(), null , |
4310 | |
StringUtils.join( packageNames.iterator(), SystemUtils.LINE_SEPARATOR ) ); |
4311 | |
} |
4312 | 0 | catch ( IOException e ) |
4313 | |
{ |
4314 | 0 | throw new MavenReportException( |
4315 | |
"Unable to write '" + packagesFile.getName() + "' temporary file for command execution", e ); |
4316 | 50 | } |
4317 | |
|
4318 | 50 | cmd.createArg().setValue( "@" + PACKAGES_FILE_NAME ); |
4319 | 50 | } |
4320 | |
|
4321 | |
|
4322 | |
|
4323 | |
|
4324 | |
|
4325 | |
|
4326 | |
private void validateJavadocOptions() |
4327 | |
throws MavenReportException |
4328 | |
{ |
4329 | |
|
4330 | 86 | if ( StringUtils.isNotEmpty( getEncoding() ) && !JavadocUtil.validateEncoding( getEncoding() ) ) |
4331 | |
{ |
4332 | 2 | throw new MavenReportException( "Unsupported option <encoding/> '" + getEncoding() + "'" ); |
4333 | |
} |
4334 | |
|
4335 | |
|
4336 | 84 | if ( StringUtils.isNotEmpty( this.locale ) ) |
4337 | |
{ |
4338 | 6 | StringTokenizer tokenizer = new StringTokenizer( this.locale, "_" ); |
4339 | 6 | final int maxTokens = 3; |
4340 | 6 | if ( tokenizer.countTokens() > maxTokens ) |
4341 | |
{ |
4342 | 2 | throw new MavenReportException( |
4343 | |
"Unsupported option <locale/> '" + this.locale + "', should be language_country_variant." ); |
4344 | |
} |
4345 | |
|
4346 | 4 | Locale localeObject = null; |
4347 | 4 | if ( tokenizer.hasMoreTokens() ) |
4348 | |
{ |
4349 | 4 | String language = tokenizer.nextToken().toLowerCase( Locale.ENGLISH ); |
4350 | 4 | if ( !Arrays.asList( Locale.getISOLanguages() ).contains( language ) ) |
4351 | |
{ |
4352 | 0 | throw new MavenReportException( |
4353 | |
"Unsupported language '" + language + "' in option <locale/> '" + this.locale + "'" ); |
4354 | |
} |
4355 | 4 | localeObject = new Locale( language ); |
4356 | |
|
4357 | 4 | if ( tokenizer.hasMoreTokens() ) |
4358 | |
{ |
4359 | 4 | String country = tokenizer.nextToken().toUpperCase( Locale.ENGLISH ); |
4360 | 4 | if ( !Arrays.asList( Locale.getISOCountries() ).contains( country ) ) |
4361 | |
{ |
4362 | 0 | throw new MavenReportException( |
4363 | |
"Unsupported country '" + country + "' in option <locale/> '" + this.locale + "'" ); |
4364 | |
} |
4365 | 4 | localeObject = new Locale( language, country ); |
4366 | |
|
4367 | 4 | if ( tokenizer.hasMoreTokens() ) |
4368 | |
{ |
4369 | 2 | String variant = tokenizer.nextToken(); |
4370 | 2 | localeObject = new Locale( language, country, variant ); |
4371 | |
} |
4372 | |
} |
4373 | |
} |
4374 | |
|
4375 | 4 | if ( localeObject == null ) |
4376 | |
{ |
4377 | 0 | throw new MavenReportException( |
4378 | |
"Unsupported option <locale/> '" + this.locale + "', should be language_country_variant." ); |
4379 | |
} |
4380 | |
|
4381 | 4 | this.locale = localeObject.toString(); |
4382 | 4 | final List<Locale> availableLocalesList = Arrays.asList( Locale.getAvailableLocales() ); |
4383 | 4 | if ( StringUtils.isNotEmpty( localeObject.getVariant() ) && !availableLocalesList.contains( localeObject ) ) |
4384 | |
{ |
4385 | 2 | StringBuilder sb = new StringBuilder(); |
4386 | 2 | sb.append( "Unsupported option <locale/> with variant '" ).append( this.locale ); |
4387 | 2 | sb.append( "'" ); |
4388 | |
|
4389 | 2 | localeObject = new Locale( localeObject.getLanguage(), localeObject.getCountry() ); |
4390 | 2 | this.locale = localeObject.toString(); |
4391 | |
|
4392 | 2 | sb.append( ", trying to use <locale/> without variant, i.e. '" ).append( this.locale ).append( "'" ); |
4393 | 2 | if ( getLog().isWarnEnabled() ) |
4394 | |
{ |
4395 | 2 | getLog().warn( sb.toString() ); |
4396 | |
} |
4397 | |
} |
4398 | |
|
4399 | 4 | if ( !availableLocalesList.contains( localeObject ) ) |
4400 | |
{ |
4401 | 0 | throw new MavenReportException( "Unsupported option <locale/> '" + this.locale + "'" ); |
4402 | |
} |
4403 | |
} |
4404 | 82 | } |
4405 | |
|
4406 | |
|
4407 | |
|
4408 | |
|
4409 | |
|
4410 | |
|
4411 | |
|
4412 | |
|
4413 | |
private void validateStandardDocletOptions() |
4414 | |
throws MavenReportException |
4415 | |
{ |
4416 | |
|
4417 | 78 | if ( StringUtils.isNotEmpty( getDocencoding() ) && !JavadocUtil.validateEncoding( getDocencoding() ) ) |
4418 | |
{ |
4419 | 2 | throw new MavenReportException( "Unsupported option <docencoding/> '" + getDocencoding() + "'" ); |
4420 | |
} |
4421 | |
|
4422 | |
|
4423 | 76 | if ( StringUtils.isNotEmpty( getCharset() ) && !JavadocUtil.validateEncoding( getCharset() ) ) |
4424 | |
{ |
4425 | 2 | throw new MavenReportException( "Unsupported option <charset/> '" + getCharset() + "'" ); |
4426 | |
} |
4427 | |
|
4428 | |
|
4429 | 74 | if ( StringUtils.isNotEmpty( helpfile ) && nohelp ) |
4430 | |
{ |
4431 | 2 | throw new MavenReportException( "Option <nohelp/> conflicts with <helpfile/>" ); |
4432 | |
} |
4433 | |
|
4434 | |
|
4435 | 72 | if ( ( getOverview() != null ) && nooverview ) |
4436 | |
{ |
4437 | 0 | throw new MavenReportException( "Option <nooverview/> conflicts with <overview/>" ); |
4438 | |
} |
4439 | |
|
4440 | |
|
4441 | 72 | if ( splitindex && noindex ) |
4442 | |
{ |
4443 | 0 | throw new MavenReportException( "Option <noindex/> conflicts with <splitindex/>" ); |
4444 | |
} |
4445 | |
|
4446 | |
|
4447 | 72 | if ( StringUtils.isNotEmpty( stylesheet ) && !( stylesheet.equalsIgnoreCase( "maven" ) |
4448 | |
|| stylesheet.equalsIgnoreCase( "java" ) ) ) |
4449 | |
{ |
4450 | 2 | throw new MavenReportException( "Option <stylesheet/> supports only \"maven\" or \"java\" value." ); |
4451 | |
} |
4452 | |
|
4453 | |
|
4454 | 70 | if ( javaApiLinks == null || javaApiLinks.size() == 0 ) |
4455 | |
{ |
4456 | 56 | javaApiLinks = DEFAULT_JAVA_API_LINKS; |
4457 | |
} |
4458 | 70 | } |
4459 | |
|
4460 | |
|
4461 | |
|
4462 | |
|
4463 | |
|
4464 | |
|
4465 | |
|
4466 | |
|
4467 | |
|
4468 | |
|
4469 | |
private boolean checkMissingArtifactsInReactor( Collection<Artifact> dependencyArtifacts, |
4470 | |
Collection<Artifact> missing ) |
4471 | |
{ |
4472 | 0 | Set<MavenProject> foundInReactor = new HashSet<MavenProject>(); |
4473 | 0 | for ( Artifact mArtifact : missing ) |
4474 | |
{ |
4475 | 0 | for ( MavenProject p : reactorProjects ) |
4476 | |
{ |
4477 | 0 | if ( p.getArtifactId().equals( mArtifact.getArtifactId() ) && p.getGroupId().equals( |
4478 | |
mArtifact.getGroupId() ) && p.getVersion().equals( mArtifact.getVersion() ) ) |
4479 | |
{ |
4480 | 0 | getLog().warn( "The dependency: [" + p.getId() |
4481 | |
+ "] can't be resolved but has been found in the reactor (probably snapshots).\n" |
4482 | |
+ "This dependency has been excluded from the Javadoc classpath. " |
4483 | |
+ "You should rerun javadoc after executing mvn install." ); |
4484 | |
|
4485 | |
|
4486 | 0 | foundInReactor.add( p ); |
4487 | 0 | break; |
4488 | |
} |
4489 | |
} |
4490 | |
} |
4491 | |
|
4492 | |
|
4493 | 0 | return foundInReactor.size() == missing.size(); |
4494 | |
} |
4495 | |
|
4496 | |
|
4497 | |
|
4498 | |
|
4499 | |
|
4500 | |
|
4501 | |
|
4502 | |
|
4503 | |
|
4504 | |
|
4505 | |
|
4506 | |
|
4507 | |
private void addJavadocOptions( List<String> arguments, List<String> sourcePaths ) |
4508 | |
throws MavenReportException |
4509 | |
{ |
4510 | 86 | validateJavadocOptions(); |
4511 | |
|
4512 | |
|
4513 | 82 | addArgIfNotEmpty( arguments, "-locale", JavadocUtil.quotedArgument( this.locale ) ); |
4514 | |
|
4515 | |
|
4516 | |
|
4517 | 82 | if ( old && isJavaDocVersionAtLeast( SINCE_JAVADOC_1_4 ) ) |
4518 | |
{ |
4519 | 2 | if ( getLog().isWarnEnabled() ) |
4520 | |
{ |
4521 | 2 | getLog().warn( "Javadoc 1.4+ doesn't support the -1.1 switch anymore. Ignore this option." ); |
4522 | |
} |
4523 | |
} |
4524 | |
else |
4525 | |
{ |
4526 | 80 | addArgIf( arguments, old, "-1.1" ); |
4527 | |
} |
4528 | |
|
4529 | 82 | addArgIfNotEmpty( arguments, "-bootclasspath", JavadocUtil.quotedPathArgument( getBootclassPath() ) ); |
4530 | |
|
4531 | 82 | if ( isJavaDocVersionAtLeast( SINCE_JAVADOC_1_5 ) ) |
4532 | |
{ |
4533 | 82 | addArgIf( arguments, breakiterator, "-breakiterator", SINCE_JAVADOC_1_5 ); |
4534 | |
} |
4535 | |
|
4536 | 82 | addArgIfNotEmpty( arguments, "-classpath", JavadocUtil.quotedPathArgument( getClasspath() ) ); |
4537 | |
|
4538 | 82 | if ( StringUtils.isNotEmpty( doclet ) ) |
4539 | |
{ |
4540 | 4 | addArgIfNotEmpty( arguments, "-doclet", JavadocUtil.quotedArgument( doclet ) ); |
4541 | 4 | addArgIfNotEmpty( arguments, "-docletpath", JavadocUtil.quotedPathArgument( getDocletPath() ) ); |
4542 | |
} |
4543 | |
|
4544 | 82 | if ( StringUtils.isEmpty( encoding ) ) |
4545 | |
{ |
4546 | 6 | getLog().warn( |
4547 | |
"Source files encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING |
4548 | |
+ ", i.e. build is platform dependent!" ); |
4549 | |
} |
4550 | 82 | addArgIfNotEmpty( arguments, "-encoding", JavadocUtil.quotedArgument( getEncoding() ) ); |
4551 | |
|
4552 | 82 | addArgIfNotEmpty( arguments, "-exclude", getExcludedPackages( sourcePaths ), SINCE_JAVADOC_1_4 ); |
4553 | |
|
4554 | 82 | addArgIfNotEmpty( arguments, "-extdirs", |
4555 | |
JavadocUtil.quotedPathArgument( JavadocUtil.unifyPathSeparator( extdirs ) ) ); |
4556 | |
|
4557 | 82 | if ( ( getOverview() != null ) && ( getOverview().exists() ) ) |
4558 | |
{ |
4559 | 0 | addArgIfNotEmpty( arguments, "-overview", |
4560 | |
JavadocUtil.quotedPathArgument( getOverview().getAbsolutePath() ) ); |
4561 | |
} |
4562 | |
|
4563 | 82 | arguments.add( getAccessLevel() ); |
4564 | |
|
4565 | 82 | if ( isJavaDocVersionAtLeast( SINCE_JAVADOC_1_5 ) ) |
4566 | |
{ |
4567 | 82 | addArgIf( arguments, quiet, "-quiet", SINCE_JAVADOC_1_5 ); |
4568 | |
} |
4569 | |
|
4570 | 82 | addArgIfNotEmpty( arguments, "-source", JavadocUtil.quotedArgument( source ), SINCE_JAVADOC_1_4 ); |
4571 | |
|
4572 | 82 | if ( ( StringUtils.isEmpty( sourcepath ) ) && ( StringUtils.isNotEmpty( subpackages ) ) ) |
4573 | |
{ |
4574 | 0 | sourcepath = StringUtils.join( sourcePaths.iterator(), File.pathSeparator ); |
4575 | |
} |
4576 | 82 | addArgIfNotEmpty( arguments, "-sourcepath", JavadocUtil.quotedPathArgument( getSourcePath( sourcePaths ) ) ); |
4577 | |
|
4578 | 82 | if ( StringUtils.isNotEmpty( sourcepath ) && isJavaDocVersionAtLeast( SINCE_JAVADOC_1_5 ) ) |
4579 | |
{ |
4580 | 4 | addArgIfNotEmpty( arguments, "-subpackages", subpackages, SINCE_JAVADOC_1_5 ); |
4581 | |
} |
4582 | |
|
4583 | 82 | addArgIf( arguments, verbose, "-verbose" ); |
4584 | |
|
4585 | 82 | addArgIfNotEmpty( arguments, null, additionalparam ); |
4586 | 82 | } |
4587 | |
|
4588 | |
|
4589 | |
|
4590 | |
|
4591 | |
|
4592 | |
|
4593 | |
|
4594 | |
|
4595 | |
|
4596 | |
|
4597 | |
|
4598 | |
|
4599 | |
|
4600 | |
private void addStandardDocletOptions( File javadocOutputDirectory, List<String> arguments ) |
4601 | |
throws MavenReportException |
4602 | |
{ |
4603 | 78 | validateStandardDocletOptions(); |
4604 | |
|
4605 | |
|
4606 | |
|
4607 | 70 | addArgIf( arguments, author, "-author" ); |
4608 | |
|
4609 | 70 | addArgIfNotEmpty( arguments, "-bottom", JavadocUtil.quotedArgument( getBottomText() ), false, false ); |
4610 | |
|
4611 | 70 | if ( !isJavaDocVersionAtLeast( SINCE_JAVADOC_1_5 ) ) |
4612 | |
{ |
4613 | 0 | addArgIf( arguments, breakiterator, "-breakiterator", SINCE_JAVADOC_1_4 ); |
4614 | |
} |
4615 | |
|
4616 | 70 | addArgIfNotEmpty( arguments, "-charset", JavadocUtil.quotedArgument( getCharset() ) ); |
4617 | |
|
4618 | 70 | addArgIfNotEmpty( arguments, "-d", JavadocUtil.quotedPathArgument( javadocOutputDirectory.toString() ) ); |
4619 | |
|
4620 | 70 | addArgIfNotEmpty( arguments, "-docencoding", JavadocUtil.quotedArgument( getDocencoding() ) ); |
4621 | |
|
4622 | 70 | addArgIf( arguments, docfilessubdirs, "-docfilessubdirs", SINCE_JAVADOC_1_4 ); |
4623 | |
|
4624 | 70 | addArgIfNotEmpty( arguments, "-doctitle", JavadocUtil.quotedArgument( getDoctitle() ), false, false ); |
4625 | |
|
4626 | 70 | if ( docfilessubdirs ) |
4627 | |
{ |
4628 | 10 | addArgIfNotEmpty( arguments, "-excludedocfilessubdir", |
4629 | |
JavadocUtil.quotedPathArgument( excludedocfilessubdir ), SINCE_JAVADOC_1_4 ); |
4630 | |
} |
4631 | |
|
4632 | 70 | addArgIfNotEmpty( arguments, "-footer", JavadocUtil.quotedArgument( footer ), false, false ); |
4633 | |
|
4634 | 70 | addGroups( arguments ); |
4635 | |
|
4636 | 70 | addArgIfNotEmpty( arguments, "-header", JavadocUtil.quotedArgument( header ), false, false ); |
4637 | |
|
4638 | 70 | addArgIfNotEmpty( arguments, "-helpfile", |
4639 | |
JavadocUtil.quotedPathArgument( getHelpFile( javadocOutputDirectory ) ) ); |
4640 | |
|
4641 | 70 | addArgIf( arguments, keywords, "-keywords", SINCE_JAVADOC_1_4_2 ); |
4642 | |
|
4643 | 70 | if ( !isOffline ) |
4644 | |
{ |
4645 | 68 | addLinkArguments( arguments ); |
4646 | |
} |
4647 | |
|
4648 | 70 | addLinkofflineArguments( arguments ); |
4649 | |
|
4650 | 70 | addArgIf( arguments, linksource, "-linksource", SINCE_JAVADOC_1_4 ); |
4651 | |
|
4652 | 70 | if ( sourcetab > 0 ) |
4653 | |
{ |
4654 | 0 | if ( fJavadocVersion == SINCE_JAVADOC_1_4_2 ) |
4655 | |
{ |
4656 | 0 | addArgIfNotEmpty( arguments, "-linksourcetab", String.valueOf( sourcetab ) ); |
4657 | |
} |
4658 | 0 | addArgIfNotEmpty( arguments, "-sourcetab", String.valueOf( sourcetab ), SINCE_JAVADOC_1_5 ); |
4659 | |
} |
4660 | |
|
4661 | 70 | addArgIf( arguments, nocomment, "-nocomment", SINCE_JAVADOC_1_4 ); |
4662 | |
|
4663 | 70 | addArgIf( arguments, nodeprecated, "-nodeprecated" ); |
4664 | |
|
4665 | 70 | addArgIf( arguments, nodeprecatedlist, "-nodeprecatedlist" ); |
4666 | |
|
4667 | 70 | addArgIf( arguments, nohelp, "-nohelp" ); |
4668 | |
|
4669 | 70 | addArgIf( arguments, noindex, "-noindex" ); |
4670 | |
|
4671 | 70 | addArgIf( arguments, nonavbar, "-nonavbar" ); |
4672 | |
|
4673 | 70 | addArgIf( arguments, nooverview, "-nooverview" ); |
4674 | |
|
4675 | 70 | addArgIfNotEmpty( arguments, "-noqualifier", JavadocUtil.quotedArgument( noqualifier ), SINCE_JAVADOC_1_4 ); |
4676 | |
|
4677 | 70 | addArgIf( arguments, nosince, "-nosince" ); |
4678 | |
|
4679 | 70 | addArgIf( arguments, notimestamp, "-notimestamp", SINCE_JAVADOC_1_5 ); |
4680 | |
|
4681 | 70 | addArgIf( arguments, notree, "-notree" ); |
4682 | |
|
4683 | 70 | addArgIfNotEmpty( arguments, "-packagesheader", JavadocUtil.quotedArgument( packagesheader ), |
4684 | |
SINCE_JAVADOC_1_4_2 ); |
4685 | |
|
4686 | 70 | if ( !isJavaDocVersionAtLeast( SINCE_JAVADOC_1_5 ) ) |
4687 | |
{ |
4688 | 0 | addArgIf( arguments, quiet, "-quiet", SINCE_JAVADOC_1_4 ); |
4689 | |
} |
4690 | |
|
4691 | 70 | addArgIf( arguments, serialwarn, "-serialwarn" ); |
4692 | |
|
4693 | 70 | addArgIf( arguments, splitindex, "-splitindex" ); |
4694 | |
|
4695 | 70 | addArgIfNotEmpty( arguments, "-stylesheetfile", |
4696 | |
JavadocUtil.quotedPathArgument( getStylesheetFile( javadocOutputDirectory ) ) ); |
4697 | |
|
4698 | 70 | if ( StringUtils.isNotEmpty( sourcepath ) && !isJavaDocVersionAtLeast( SINCE_JAVADOC_1_5 ) ) |
4699 | |
{ |
4700 | 0 | addArgIfNotEmpty( arguments, "-subpackages", subpackages, SINCE_JAVADOC_1_4 ); |
4701 | |
} |
4702 | |
|
4703 | 70 | addArgIfNotEmpty( arguments, "-taglet", JavadocUtil.quotedArgument( taglet ), SINCE_JAVADOC_1_4 ); |
4704 | 70 | addTaglets( arguments ); |
4705 | 70 | addTagletsFromTagletArtifacts( arguments ); |
4706 | 70 | addArgIfNotEmpty( arguments, "-tagletpath", JavadocUtil.quotedPathArgument( getTagletPath() ), |
4707 | |
SINCE_JAVADOC_1_4 ); |
4708 | |
|
4709 | 70 | addTags( arguments ); |
4710 | |
|
4711 | 70 | addArgIfNotEmpty( arguments, "-top", JavadocUtil.quotedArgument( top ), false, false, SINCE_JAVADOC_1_6 ); |
4712 | |
|
4713 | 70 | addArgIf( arguments, use, "-use" ); |
4714 | |
|
4715 | 70 | addArgIf( arguments, version, "-version" ); |
4716 | |
|
4717 | 70 | addArgIfNotEmpty( arguments, "-windowtitle", JavadocUtil.quotedArgument( getWindowtitle() ), false, false ); |
4718 | 70 | } |
4719 | |
|
4720 | |
|
4721 | |
|
4722 | |
|
4723 | |
|
4724 | |
|
4725 | |
|
4726 | |
private void addGroups( List<String> arguments ) |
4727 | |
throws MavenReportException |
4728 | |
{ |
4729 | 70 | Set<Group> groups = collectGroups(); |
4730 | 70 | if ( isEmpty( groups ) ) |
4731 | |
{ |
4732 | 68 | return; |
4733 | |
} |
4734 | |
|
4735 | 2 | for ( Group group : groups ) |
4736 | |
{ |
4737 | 4 | if ( group == null || StringUtils.isEmpty( group.getTitle() ) || StringUtils.isEmpty( |
4738 | |
group.getPackages() ) ) |
4739 | |
{ |
4740 | 0 | if ( getLog().isWarnEnabled() ) |
4741 | |
{ |
4742 | 0 | getLog().warn( "A group option is empty. Ignore this option." ); |
4743 | |
} |
4744 | |
} |
4745 | |
else |
4746 | |
{ |
4747 | 4 | String groupTitle = StringUtils.replace( group.getTitle(), ",", "," ); |
4748 | 4 | addArgIfNotEmpty( arguments, "-group", |
4749 | |
JavadocUtil.quotedArgument( groupTitle ) + " " + JavadocUtil.quotedArgument( |
4750 | |
group.getPackages() ), true ); |
4751 | 4 | } |
4752 | |
} |
4753 | 2 | } |
4754 | |
|
4755 | |
|
4756 | |
|
4757 | |
|
4758 | |
|
4759 | |
|
4760 | |
|
4761 | |
private void addTags( List<String> arguments ) |
4762 | |
throws MavenReportException |
4763 | |
{ |
4764 | 70 | Set<Tag> tags = collectTags(); |
4765 | |
|
4766 | 70 | if ( isEmpty( tags ) ) |
4767 | |
{ |
4768 | 66 | return; |
4769 | |
} |
4770 | |
|
4771 | 4 | for ( Tag tag : tags ) |
4772 | |
{ |
4773 | 12 | if ( StringUtils.isEmpty( tag.getName() ) ) |
4774 | |
{ |
4775 | 0 | if ( getLog().isWarnEnabled() ) |
4776 | |
{ |
4777 | 0 | getLog().warn( "A tag name is empty. Ignore this option." ); |
4778 | |
} |
4779 | |
} |
4780 | |
else |
4781 | |
{ |
4782 | 12 | String value = "\"" + tag.getName(); |
4783 | 12 | if ( StringUtils.isNotEmpty( tag.getPlacement() ) ) |
4784 | |
{ |
4785 | 10 | value += ":" + tag.getPlacement(); |
4786 | 10 | if ( StringUtils.isNotEmpty( tag.getHead() ) ) |
4787 | |
{ |
4788 | 10 | value += ":" + tag.getHead(); |
4789 | |
} |
4790 | |
} |
4791 | 12 | value += "\""; |
4792 | 12 | addArgIfNotEmpty( arguments, "-tag", value, SINCE_JAVADOC_1_4 ); |
4793 | 12 | } |
4794 | |
} |
4795 | 4 | } |
4796 | |
|
4797 | |
|
4798 | |
|
4799 | |
|
4800 | |
|
4801 | |
|
4802 | |
private void addTaglets( List<String> arguments ) |
4803 | |
{ |
4804 | 70 | if ( taglets == null ) |
4805 | |
{ |
4806 | 70 | return; |
4807 | |
} |
4808 | |
|
4809 | 0 | for ( int i = 0; i < taglets.length; i++ ) |
4810 | |
{ |
4811 | 0 | if ( ( taglets[i] == null ) || ( StringUtils.isEmpty( taglets[i].getTagletClass() ) ) ) |
4812 | |
{ |
4813 | 0 | if ( getLog().isWarnEnabled() ) |
4814 | |
{ |
4815 | 0 | getLog().warn( "A taglet option is empty. Ignore this option." ); |
4816 | |
} |
4817 | |
} |
4818 | |
else |
4819 | |
{ |
4820 | 0 | addArgIfNotEmpty( arguments, "-taglet", JavadocUtil.quotedArgument( taglets[i].getTagletClass() ), |
4821 | |
SINCE_JAVADOC_1_4 ); |
4822 | |
} |
4823 | |
} |
4824 | 0 | } |
4825 | |
|
4826 | |
|
4827 | |
|
4828 | |
|
4829 | |
|
4830 | |
|
4831 | |
|
4832 | |
|
4833 | |
private void addTagletsFromTagletArtifacts( List<String> arguments ) |
4834 | |
throws MavenReportException |
4835 | |
{ |
4836 | 70 | Set<TagletArtifact> tArtifacts = new LinkedHashSet<TagletArtifact>(); |
4837 | 70 | if ( tagletArtifacts != null && tagletArtifacts.length > 0 ) |
4838 | |
{ |
4839 | 2 | tArtifacts.addAll( Arrays.asList( tagletArtifacts ) ); |
4840 | |
} |
4841 | |
|
4842 | 70 | if ( includeDependencySources ) |
4843 | |
{ |
4844 | |
try |
4845 | |
{ |
4846 | 0 | resolveDependencyBundles(); |
4847 | |
} |
4848 | 0 | catch ( IOException e ) |
4849 | |
{ |
4850 | 0 | throw new MavenReportException( |
4851 | |
"Failed to resolve javadoc bundles from dependencies: " + e.getMessage(), e ); |
4852 | 0 | } |
4853 | |
|
4854 | 0 | if ( isNotEmpty( dependencyJavadocBundles ) ) |
4855 | |
{ |
4856 | 0 | for ( JavadocBundle bundle : dependencyJavadocBundles ) |
4857 | |
{ |
4858 | 0 | JavadocOptions options = bundle.getOptions(); |
4859 | 0 | if ( options != null && isNotEmpty( options.getTagletArtifacts() ) ) |
4860 | |
{ |
4861 | 0 | tArtifacts.addAll( options.getTagletArtifacts() ); |
4862 | |
} |
4863 | 0 | } |
4864 | |
} |
4865 | |
} |
4866 | |
|
4867 | 70 | if ( isEmpty( tArtifacts ) ) |
4868 | |
{ |
4869 | 68 | return; |
4870 | |
} |
4871 | |
|
4872 | 2 | List<String> tagletsPath = new ArrayList<String>(); |
4873 | |
|
4874 | 2 | for ( TagletArtifact aTagletArtifact : tArtifacts ) |
4875 | |
{ |
4876 | 4 | if ( ( StringUtils.isNotEmpty( aTagletArtifact.getGroupId() ) ) && ( StringUtils.isNotEmpty( |
4877 | |
aTagletArtifact.getArtifactId() ) ) && ( StringUtils.isNotEmpty( aTagletArtifact.getVersion() ) ) ) |
4878 | |
{ |
4879 | |
Artifact artifact; |
4880 | |
try |
4881 | |
{ |
4882 | 4 | artifact = createAndResolveArtifact( aTagletArtifact ); |
4883 | |
} |
4884 | 0 | catch ( ArtifactResolutionException e ) |
4885 | |
{ |
4886 | 0 | throw new MavenReportException( "Unable to resolve artifact:" + aTagletArtifact, e ); |
4887 | |
} |
4888 | 0 | catch ( ArtifactNotFoundException e ) |
4889 | |
{ |
4890 | 0 | throw new MavenReportException( "Unable to find artifact:" + aTagletArtifact, e ); |
4891 | |
} |
4892 | 0 | catch ( ProjectBuildingException e ) |
4893 | |
{ |
4894 | 0 | throw new MavenReportException( |
4895 | |
"Unable to build the Maven project for the artifact:" + aTagletArtifact, e ); |
4896 | 4 | } |
4897 | |
|
4898 | 4 | tagletsPath.add( artifact.getFile().getAbsolutePath() ); |
4899 | 4 | } |
4900 | |
} |
4901 | |
|
4902 | 2 | tagletsPath = JavadocUtil.pruneFiles( tagletsPath ); |
4903 | |
|
4904 | 2 | for ( String tagletJar : tagletsPath ) |
4905 | |
{ |
4906 | 4 | if ( !tagletJar.toLowerCase( Locale.ENGLISH ).endsWith( ".jar" ) ) |
4907 | |
{ |
4908 | 0 | continue; |
4909 | |
} |
4910 | |
|
4911 | |
List<String> tagletClasses; |
4912 | |
try |
4913 | |
{ |
4914 | 4 | tagletClasses = JavadocUtil.getTagletClassNames( new File( tagletJar ) ); |
4915 | |
} |
4916 | 0 | catch ( IOException e ) |
4917 | |
{ |
4918 | 0 | if ( getLog().isWarnEnabled() ) |
4919 | |
{ |
4920 | 0 | getLog().warn( "Unable to auto-detect Taglet class names from '" + tagletJar |
4921 | |
+ "'. Try to specify them with <taglets/>." ); |
4922 | |
} |
4923 | 0 | if ( getLog().isDebugEnabled() ) |
4924 | |
{ |
4925 | 0 | getLog().debug( "IOException: " + e.getMessage(), e ); |
4926 | |
} |
4927 | 0 | continue; |
4928 | |
} |
4929 | 0 | catch ( ClassNotFoundException e ) |
4930 | |
{ |
4931 | 0 | if ( getLog().isWarnEnabled() ) |
4932 | |
{ |
4933 | 0 | getLog().warn( "Unable to auto-detect Taglet class names from '" + tagletJar |
4934 | |
+ "'. Try to specify them with <taglets/>." ); |
4935 | |
} |
4936 | 0 | if ( getLog().isDebugEnabled() ) |
4937 | |
{ |
4938 | 0 | getLog().debug( "ClassNotFoundException: " + e.getMessage(), e ); |
4939 | |
} |
4940 | 0 | continue; |
4941 | |
} |
4942 | 0 | catch ( NoClassDefFoundError e ) |
4943 | |
{ |
4944 | 0 | if ( getLog().isWarnEnabled() ) |
4945 | |
{ |
4946 | 0 | getLog().warn( "Unable to auto-detect Taglet class names from '" + tagletJar |
4947 | |
+ "'. Try to specify them with <taglets/>." ); |
4948 | |
} |
4949 | 0 | if ( getLog().isDebugEnabled() ) |
4950 | |
{ |
4951 | 0 | getLog().debug( "NoClassDefFoundError: " + e.getMessage(), e ); |
4952 | |
} |
4953 | 0 | continue; |
4954 | 4 | } |
4955 | |
|
4956 | 4 | if ( tagletClasses != null && !tagletClasses.isEmpty() ) |
4957 | |
{ |
4958 | 4 | for ( String tagletClass : tagletClasses ) |
4959 | |
{ |
4960 | 40 | addArgIfNotEmpty( arguments, "-taglet", JavadocUtil.quotedArgument( tagletClass ), |
4961 | |
SINCE_JAVADOC_1_4 ); |
4962 | |
} |
4963 | |
} |
4964 | 4 | } |
4965 | 2 | } |
4966 | |
|
4967 | |
|
4968 | |
|
4969 | |
|
4970 | |
|
4971 | |
|
4972 | |
|
4973 | |
|
4974 | |
private void executeJavadocCommandLine( Commandline cmd, File javadocOutputDirectory ) |
4975 | |
throws MavenReportException |
4976 | |
{ |
4977 | 74 | if ( getLog().isDebugEnabled() ) |
4978 | |
{ |
4979 | |
|
4980 | 0 | getLog().debug( CommandLineUtils.toString( cmd.getCommandline() ).replaceAll( "'", "" ) ); |
4981 | |
} |
4982 | |
|
4983 | 74 | String cmdLine = null; |
4984 | 74 | if ( debug ) |
4985 | |
{ |
4986 | 74 | cmdLine = CommandLineUtils.toString( cmd.getCommandline() ).replaceAll( "'", "" ); |
4987 | 74 | cmdLine = JavadocUtil.hideProxyPassword( cmdLine, settings ); |
4988 | |
|
4989 | 74 | writeDebugJavadocScript( cmdLine, javadocOutputDirectory ); |
4990 | |
} |
4991 | |
|
4992 | 74 | CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer(); |
4993 | 74 | CommandLineUtils.StringStreamConsumer out = new CommandLineUtils.StringStreamConsumer(); |
4994 | |
try |
4995 | |
{ |
4996 | 74 | int exitCode = CommandLineUtils.executeCommandLine( cmd, out, err ); |
4997 | |
|
4998 | 74 | String output = ( StringUtils.isEmpty( out.getOutput() ) ? null : '\n' + out.getOutput().trim() ); |
4999 | |
|
5000 | 74 | if ( exitCode != 0 ) |
5001 | |
{ |
5002 | 0 | if ( cmdLine == null ) |
5003 | |
{ |
5004 | 0 | cmdLine = CommandLineUtils.toString( cmd.getCommandline() ).replaceAll( "'", "" ); |
5005 | 0 | cmdLine = JavadocUtil.hideProxyPassword( cmdLine, settings ); |
5006 | |
} |
5007 | 0 | writeDebugJavadocScript( cmdLine, javadocOutputDirectory ); |
5008 | |
|
5009 | 0 | if ( StringUtils.isNotEmpty( output ) && StringUtils.isEmpty( err.getOutput() ) && isJavadocVMInitError( |
5010 | |
output ) ) |
5011 | |
{ |
5012 | 0 | StringBuilder msg = new StringBuilder(); |
5013 | 0 | msg.append( output ); |
5014 | 0 | msg.append( '\n' ).append( '\n' ); |
5015 | 0 | msg.append( JavadocUtil.ERROR_INIT_VM ).append( '\n' ); |
5016 | 0 | msg.append( "Or, try to reduce the Java heap size for the Javadoc goal using " ); |
5017 | 0 | msg.append( "-Dminmemory=<size> and -Dmaxmemory=<size>." ).append( '\n' ).append( '\n' ); |
5018 | |
|
5019 | 0 | msg.append( "Command line was: " ).append( cmdLine ).append( '\n' ).append( '\n' ); |
5020 | 0 | msg.append( "Refer to the generated Javadoc files in '" ).append( javadocOutputDirectory ).append( |
5021 | |
"' dir.\n" ); |
5022 | |
|
5023 | 0 | throw new MavenReportException( msg.toString() ); |
5024 | |
} |
5025 | |
|
5026 | 0 | if ( StringUtils.isNotEmpty( output ) ) |
5027 | |
{ |
5028 | 0 | getLog().info( output ); |
5029 | |
} |
5030 | |
|
5031 | 0 | StringBuilder msg = new StringBuilder( "\nExit code: " ); |
5032 | 0 | msg.append( exitCode ); |
5033 | 0 | if ( StringUtils.isNotEmpty( err.getOutput() ) ) |
5034 | |
{ |
5035 | 0 | msg.append( " - " ).append( err.getOutput() ); |
5036 | |
} |
5037 | 0 | msg.append( '\n' ); |
5038 | 0 | msg.append( "Command line was: " ).append( cmdLine ).append( '\n' ).append( '\n' ); |
5039 | |
|
5040 | 0 | msg.append( "Refer to the generated Javadoc files in '" ).append( javadocOutputDirectory ).append( |
5041 | |
"' dir.\n" ); |
5042 | |
|
5043 | 0 | throw new MavenReportException( msg.toString() ); |
5044 | |
} |
5045 | |
|
5046 | 74 | if ( StringUtils.isNotEmpty( output ) ) |
5047 | |
{ |
5048 | 2 | getLog().info( output ); |
5049 | |
} |
5050 | |
} |
5051 | 0 | catch ( CommandLineException e ) |
5052 | |
{ |
5053 | 0 | throw new MavenReportException( "Unable to execute javadoc command: " + e.getMessage(), e ); |
5054 | 74 | } |
5055 | |
|
5056 | |
|
5057 | |
|
5058 | |
|
5059 | |
|
5060 | 74 | if ( StringUtils.isNotEmpty( err.getOutput() ) && getLog().isWarnEnabled() ) |
5061 | |
{ |
5062 | 2 | getLog().warn( "Javadoc Warnings" ); |
5063 | |
|
5064 | 2 | StringTokenizer token = new StringTokenizer( err.getOutput(), "\n" ); |
5065 | 4 | while ( token.hasMoreTokens() ) |
5066 | |
{ |
5067 | 2 | String current = token.nextToken().trim(); |
5068 | |
|
5069 | 2 | getLog().warn( current ); |
5070 | 2 | } |
5071 | |
} |
5072 | 74 | } |
5073 | |
|
5074 | |
|
5075 | |
|
5076 | |
|
5077 | |
|
5078 | |
|
5079 | |
|
5080 | |
|
5081 | |
private String getResource( File outputFile, String inputResourceName ) |
5082 | |
{ |
5083 | 8 | if ( inputResourceName.startsWith( "/" ) ) |
5084 | |
{ |
5085 | 0 | inputResourceName = inputResourceName.replaceFirst( "//*", "" ); |
5086 | |
} |
5087 | |
|
5088 | 8 | List<String> classPath = new ArrayList<String>(); |
5089 | 8 | classPath.add( project.getBuild().getSourceDirectory() ); |
5090 | |
|
5091 | 8 | URL resourceURL = getResource( classPath, inputResourceName ); |
5092 | 8 | if ( resourceURL != null ) |
5093 | |
{ |
5094 | 0 | getLog().debug( inputResourceName + " found in the main src directory of the project." ); |
5095 | 0 | return FileUtils.toFile( resourceURL ).getAbsolutePath(); |
5096 | |
} |
5097 | |
|
5098 | 8 | classPath.clear(); |
5099 | 8 | List<Resource> resources = project.getBuild().getResources(); |
5100 | 8 | for ( Resource resource : resources ) |
5101 | |
{ |
5102 | 8 | classPath.add( resource.getDirectory() ); |
5103 | |
} |
5104 | 8 | resourceURL = getResource( classPath, inputResourceName ); |
5105 | 8 | if ( resourceURL != null ) |
5106 | |
{ |
5107 | 4 | getLog().debug( inputResourceName + " found in the main resources directories of the project." ); |
5108 | 4 | return FileUtils.toFile( resourceURL ).getAbsolutePath(); |
5109 | |
} |
5110 | |
|
5111 | 4 | if ( javadocDirectory.exists() ) |
5112 | |
{ |
5113 | 0 | classPath.clear(); |
5114 | 0 | classPath.add( javadocDirectory.getAbsolutePath() ); |
5115 | 0 | resourceURL = getResource( classPath, inputResourceName ); |
5116 | 0 | if ( resourceURL != null ) |
5117 | |
{ |
5118 | 0 | getLog().debug( inputResourceName + " found in the main javadoc directory of the project." ); |
5119 | 0 | return FileUtils.toFile( resourceURL ).getAbsolutePath(); |
5120 | |
} |
5121 | |
} |
5122 | |
|
5123 | 4 | classPath.clear(); |
5124 | 4 | final String pluginId = "org.apache.maven.plugins:maven-javadoc-plugin"; |
5125 | 4 | Plugin javadocPlugin = getPlugin( project, pluginId ); |
5126 | 4 | if ( javadocPlugin != null && javadocPlugin.getDependencies() != null ) |
5127 | |
{ |
5128 | 4 | List<Dependency> dependencies = javadocPlugin.getDependencies(); |
5129 | 4 | for ( Dependency dependency : dependencies ) |
5130 | |
{ |
5131 | 4 | JavadocPathArtifact javadocPathArtifact = new JavadocPathArtifact(); |
5132 | 4 | javadocPathArtifact.setGroupId( dependency.getGroupId() ); |
5133 | 4 | javadocPathArtifact.setArtifactId( dependency.getArtifactId() ); |
5134 | 4 | javadocPathArtifact.setVersion( dependency.getVersion() ); |
5135 | 4 | Artifact artifact = null; |
5136 | |
try |
5137 | |
{ |
5138 | 4 | artifact = createAndResolveArtifact( javadocPathArtifact ); |
5139 | |
} |
5140 | 0 | catch ( Exception e ) |
5141 | |
{ |
5142 | 0 | logError( "Unable to retrieve the dependency: " + dependency + ". Ignored.", e ); |
5143 | 4 | } |
5144 | |
|
5145 | 4 | if ( artifact != null && artifact.getFile().exists() ) |
5146 | |
{ |
5147 | 4 | classPath.add( artifact.getFile().getAbsolutePath() ); |
5148 | |
} |
5149 | 4 | } |
5150 | 4 | resourceURL = getResource( classPath, inputResourceName ); |
5151 | 4 | if ( resourceURL != null ) |
5152 | |
{ |
5153 | 4 | getLog().debug( inputResourceName + " found in javadoc plugin dependencies." ); |
5154 | |
try |
5155 | |
{ |
5156 | 4 | JavadocUtil.copyResource( resourceURL, outputFile ); |
5157 | |
|
5158 | 4 | return outputFile.getAbsolutePath(); |
5159 | |
} |
5160 | 0 | catch ( IOException e ) |
5161 | |
{ |
5162 | 0 | logError( "IOException: " + e.getMessage(), e ); |
5163 | |
} |
5164 | |
} |
5165 | |
} |
5166 | |
|
5167 | 0 | getLog().warn( "Unable to find the resource '" + inputResourceName + "'. Using default Javadoc resources." ); |
5168 | |
|
5169 | 0 | return null; |
5170 | |
} |
5171 | |
|
5172 | |
|
5173 | |
|
5174 | |
|
5175 | |
|
5176 | |
|
5177 | |
|
5178 | |
|
5179 | |
private URL getResource( final List<String> classPath, final String resource ) |
5180 | |
{ |
5181 | 20 | List<URL> urls = new ArrayList<URL>( classPath.size() ); |
5182 | 20 | for ( String filename : classPath ) |
5183 | |
{ |
5184 | |
try |
5185 | |
{ |
5186 | 20 | urls.add( new File( filename ).toURL() ); |
5187 | |
} |
5188 | 0 | catch ( MalformedURLException e ) |
5189 | |
{ |
5190 | 0 | getLog().error( "MalformedURLException: " + e.getMessage() ); |
5191 | 40 | } |
5192 | |
} |
5193 | |
|
5194 | 20 | ClassLoader javadocClassLoader = new URLClassLoader( (URL[]) urls.toArray( new URL[urls.size()] ), null ); |
5195 | |
|
5196 | 20 | return javadocClassLoader.getResource( resource ); |
5197 | |
} |
5198 | |
|
5199 | |
|
5200 | |
|
5201 | |
|
5202 | |
|
5203 | |
|
5204 | |
private String getFullJavadocGoal() |
5205 | |
{ |
5206 | 0 | String javadocPluginVersion = null; |
5207 | 0 | InputStream resourceAsStream = null; |
5208 | |
try |
5209 | |
{ |
5210 | 0 | String resource = "META-INF/maven/org.apache.maven.plugins/maven-javadoc-plugin/pom.properties"; |
5211 | 0 | resourceAsStream = AbstractJavadocMojo.class.getClassLoader().getResourceAsStream( resource ); |
5212 | |
|
5213 | 0 | if ( resourceAsStream != null ) |
5214 | |
{ |
5215 | 0 | Properties properties = new Properties(); |
5216 | 0 | properties.load( resourceAsStream ); |
5217 | |
|
5218 | 0 | if ( StringUtils.isNotEmpty( properties.getProperty( "version" ) ) ) |
5219 | |
{ |
5220 | 0 | javadocPluginVersion = properties.getProperty( "version" ); |
5221 | |
} |
5222 | |
} |
5223 | |
} |
5224 | 0 | catch ( IOException e ) |
5225 | |
{ |
5226 | |
|
5227 | |
} |
5228 | |
finally |
5229 | |
{ |
5230 | 0 | IOUtil.close( resourceAsStream ); |
5231 | 0 | } |
5232 | |
|
5233 | 0 | StringBuilder sb = new StringBuilder(); |
5234 | |
|
5235 | 0 | sb.append( "org.apache.maven.plugins:maven-javadoc-plugin:" ); |
5236 | 0 | if ( StringUtils.isNotEmpty( javadocPluginVersion ) ) |
5237 | |
{ |
5238 | 0 | sb.append( javadocPluginVersion ).append( ":" ); |
5239 | |
} |
5240 | |
|
5241 | 0 | if ( this instanceof TestJavadocReport ) |
5242 | |
{ |
5243 | 0 | sb.append( "test-javadoc" ); |
5244 | |
} |
5245 | |
else |
5246 | |
{ |
5247 | 0 | sb.append( "javadoc" ); |
5248 | |
} |
5249 | |
|
5250 | 0 | return sb.toString(); |
5251 | |
} |
5252 | |
|
5253 | |
|
5254 | |
|
5255 | |
|
5256 | |
|
5257 | |
|
5258 | |
|
5259 | |
|
5260 | |
|
5261 | |
|
5262 | |
|
5263 | |
private List<OfflineLink> getModulesLinks() |
5264 | |
throws MavenReportException |
5265 | |
{ |
5266 | 70 | if ( !detectOfflineLinks || isAggregator() || reactorProjects == null ) |
5267 | |
{ |
5268 | 70 | return Collections.emptyList(); |
5269 | |
} |
5270 | |
|
5271 | 0 | getLog().debug( "Trying to add links for modules..." ); |
5272 | |
|
5273 | 0 | Set<String> dependencyArtifactIds = new HashSet<String>(); |
5274 | 0 | final Set<Artifact> dependencyArtifacts = project.getDependencyArtifacts(); |
5275 | 0 | for ( Artifact artifact : dependencyArtifacts ) |
5276 | |
{ |
5277 | 0 | dependencyArtifactIds.add( artifact.getId() ); |
5278 | |
} |
5279 | |
|
5280 | 0 | List<OfflineLink> modulesLinks = new ArrayList<OfflineLink>(); |
5281 | 0 | String javadocDirRelative = PathUtils.toRelative( project.getBasedir(), getOutputDirectory() ); |
5282 | 0 | for ( MavenProject p : reactorProjects ) |
5283 | |
{ |
5284 | 0 | if ( !dependencyArtifactIds.contains( p.getArtifact().getId() ) || ( p.getUrl() == null ) ) |
5285 | |
{ |
5286 | 0 | continue; |
5287 | |
} |
5288 | |
|
5289 | 0 | File location = new File( p.getBasedir(), javadocDirRelative ); |
5290 | |
|
5291 | 0 | if ( !location.exists() ) |
5292 | |
{ |
5293 | 0 | if ( getLog().isDebugEnabled() ) |
5294 | |
{ |
5295 | 0 | getLog().debug( "Javadoc directory not found: " + location ); |
5296 | |
} |
5297 | |
|
5298 | 0 | String javadocGoal = getFullJavadocGoal(); |
5299 | 0 | getLog().info( |
5300 | |
"The goal '" + javadocGoal + "' has not been previously called for the module: '" + p.getId() |
5301 | |
+ "'. Trying to invoke it..." ); |
5302 | |
|
5303 | 0 | File invokerDir = new File( project.getBuild().getDirectory(), "invoker" ); |
5304 | 0 | invokerDir.mkdirs(); |
5305 | 0 | File invokerLogFile = FileUtils.createTempFile( "maven-javadoc-plugin", ".txt", invokerDir ); |
5306 | |
try |
5307 | |
{ |
5308 | 0 | JavadocUtil.invokeMaven( getLog(), new File( localRepository.getBasedir() ), p.getFile(), |
5309 | |
Collections.singletonList( javadocGoal ), null, invokerLogFile ); |
5310 | |
} |
5311 | 0 | catch ( MavenInvocationException e ) |
5312 | |
{ |
5313 | 0 | logError( "MavenInvocationException: " + e.getMessage(), e ); |
5314 | |
|
5315 | 0 | String invokerLogContent = JavadocUtil.readFile( invokerLogFile, null ); |
5316 | |
|
5317 | |
|
5318 | |
|
5319 | |
|
5320 | 0 | if ( invokerLogContent != null && invokerLogContent.contains( JavadocUtil.ERROR_INIT_VM ) ) |
5321 | |
{ |
5322 | 0 | throw new MavenReportException( e.getMessage(), e ); |
5323 | |
} |
5324 | |
} |
5325 | |
finally |
5326 | |
{ |
5327 | |
|
5328 | 0 | if ( !location.exists() ) |
5329 | |
{ |
5330 | 0 | getLog().warn( "Creating fake javadoc directory to prevent repeated invocations: " + location ); |
5331 | 0 | location.mkdirs(); |
5332 | |
} |
5333 | |
} |
5334 | |
} |
5335 | |
|
5336 | 0 | if ( location.exists() ) |
5337 | |
{ |
5338 | 0 | String url = getJavadocLink( p ); |
5339 | |
|
5340 | 0 | OfflineLink ol = new OfflineLink(); |
5341 | 0 | ol.setUrl( url ); |
5342 | 0 | ol.setLocation( location.getAbsolutePath() ); |
5343 | |
|
5344 | 0 | if ( getLog().isDebugEnabled() ) |
5345 | |
{ |
5346 | 0 | getLog().debug( "Added Javadoc offline link: " + url + " for the module: " + p.getId() ); |
5347 | |
} |
5348 | |
|
5349 | 0 | modulesLinks.add( ol ); |
5350 | |
} |
5351 | 0 | } |
5352 | |
|
5353 | 0 | return modulesLinks; |
5354 | |
} |
5355 | |
|
5356 | |
|
5357 | |
|
5358 | |
|
5359 | |
|
5360 | |
|
5361 | |
|
5362 | |
|
5363 | |
|
5364 | |
|
5365 | |
private List<String> getDependenciesLinks() |
5366 | |
{ |
5367 | 68 | if ( !detectLinks ) |
5368 | |
{ |
5369 | 62 | return Collections.emptyList(); |
5370 | |
} |
5371 | |
|
5372 | 6 | getLog().debug( "Trying to add links for dependencies..." ); |
5373 | |
|
5374 | 6 | List<String> dependenciesLinks = new ArrayList<String>(); |
5375 | |
|
5376 | 6 | final Set<Artifact> dependencies = project.getDependencyArtifacts(); |
5377 | 6 | for ( Artifact artifact : dependencies ) |
5378 | |
{ |
5379 | 6 | if ( artifact.getFile() == null || !artifact.getFile().exists() ) |
5380 | |
{ |
5381 | 0 | continue; |
5382 | |
} |
5383 | |
|
5384 | |
try |
5385 | |
{ |
5386 | 6 | MavenProject artifactProject = |
5387 | |
mavenProjectBuilder.buildFromRepository( artifact, remoteRepositories, localRepository ); |
5388 | |
|
5389 | 6 | if ( StringUtils.isNotEmpty( artifactProject.getUrl() ) ) |
5390 | |
{ |
5391 | 0 | String url = getJavadocLink( artifactProject ); |
5392 | |
|
5393 | 0 | if ( isValidJavadocLink( url ) ) |
5394 | |
{ |
5395 | 0 | getLog().debug( "Added Javadoc link: " + url + " for " + artifactProject.getId() ); |
5396 | |
|
5397 | 0 | dependenciesLinks.add( url ); |
5398 | |
} |
5399 | |
} |
5400 | |
} |
5401 | 0 | catch ( ProjectBuildingException e ) |
5402 | |
{ |
5403 | 0 | logError( "ProjectBuildingException for " + artifact.toString() + ": " + e.getMessage(), e ); |
5404 | 12 | } |
5405 | |
} |
5406 | |
|
5407 | 6 | return dependenciesLinks; |
5408 | |
} |
5409 | |
|
5410 | |
|
5411 | |
|
5412 | |
|
5413 | |
|
5414 | |
|
5415 | |
|
5416 | |
|
5417 | |
|
5418 | |
|
5419 | |
|
5420 | |
|
5421 | |
private OfflineLink getDefaultJavadocApiLink() |
5422 | |
{ |
5423 | 70 | if ( !detectJavaApiLink ) |
5424 | |
{ |
5425 | 68 | return null; |
5426 | |
} |
5427 | |
|
5428 | 2 | final String pluginId = "org.apache.maven.plugins:maven-compiler-plugin"; |
5429 | 2 | float sourceVersion = fJavadocVersion; |
5430 | 2 | String sourceConfigured = getPluginParameter( project, pluginId, "source" ); |
5431 | 2 | if ( sourceConfigured != null ) |
5432 | |
{ |
5433 | |
try |
5434 | |
{ |
5435 | 0 | sourceVersion = Float.parseFloat( sourceConfigured ); |
5436 | |
} |
5437 | 0 | catch ( NumberFormatException e ) |
5438 | |
{ |
5439 | 0 | getLog().debug( |
5440 | |
"NumberFormatException for the source parameter in the maven-compiler-plugin. " + "Ignored it", e ); |
5441 | 0 | } |
5442 | |
} |
5443 | |
else |
5444 | |
{ |
5445 | 2 | getLog().debug( "No maven-compiler-plugin defined in ${build.plugins} or in " |
5446 | |
+ "${project.build.pluginManagement} for the " + project.getId() |
5447 | |
+ ". Added Javadoc API link according the javadoc executable version i.e.: " |
5448 | |
+ fJavadocVersion ); |
5449 | |
} |
5450 | |
|
5451 | 2 | String apiVersion = null; |
5452 | 2 | if ( sourceVersion >= 1.3f && sourceVersion < 1.4f ) |
5453 | |
{ |
5454 | 0 | apiVersion = "1.3"; |
5455 | |
} |
5456 | 2 | else if ( sourceVersion >= 1.4f && sourceVersion < 1.5f ) |
5457 | |
{ |
5458 | 0 | apiVersion = "1.4"; |
5459 | |
} |
5460 | 2 | else if ( sourceVersion >= 1.5f && sourceVersion < 1.6f ) |
5461 | |
{ |
5462 | 0 | apiVersion = "1.5"; |
5463 | |
} |
5464 | 2 | else if ( sourceVersion >= 1.6f && sourceVersion < 1.7f ) |
5465 | |
{ |
5466 | 2 | apiVersion = "1.6"; |
5467 | |
} |
5468 | 0 | else if ( sourceVersion >= 1.7f ) |
5469 | |
{ |
5470 | 0 | apiVersion = "1.7"; |
5471 | |
} |
5472 | 2 | String javaApiLink = javaApiLinks.getProperty( "api_" + apiVersion, null ); |
5473 | |
|
5474 | 2 | if ( getLog().isDebugEnabled() ) |
5475 | |
{ |
5476 | 0 | if ( StringUtils.isNotEmpty( javaApiLink ) ) |
5477 | |
{ |
5478 | 0 | getLog().debug( "Found Java API link: " + javaApiLink ); |
5479 | |
} |
5480 | |
else |
5481 | |
{ |
5482 | 0 | getLog().debug( "No Java API link found." ); |
5483 | |
} |
5484 | |
} |
5485 | |
|
5486 | 2 | if ( javaApiLink == null ) |
5487 | |
{ |
5488 | 0 | return null; |
5489 | |
} |
5490 | |
|
5491 | 2 | File javaApiPackageListFile = new File( getJavadocOptionsFile().getParentFile(), "package-list" ); |
5492 | |
|
5493 | 2 | OfflineLink link = new OfflineLink(); |
5494 | 2 | link.setLocation( javaApiPackageListFile.getParentFile().getAbsolutePath() ); |
5495 | 2 | link.setUrl( javaApiLink ); |
5496 | |
|
5497 | 2 | InputStream in = this.getClass().getResourceAsStream( "java-api-package-list-" + apiVersion ); |
5498 | 2 | OutputStream out = null; |
5499 | |
try |
5500 | |
{ |
5501 | 2 | out = new FileOutputStream( javaApiPackageListFile ); |
5502 | 2 | IOUtil.copy( in, out ); |
5503 | |
} |
5504 | 0 | catch ( IOException ioe ) |
5505 | |
{ |
5506 | 0 | logError( "Can't get java-api-package-list-" + apiVersion + ": " + ioe.getMessage(), ioe ); |
5507 | 0 | return null; |
5508 | |
} |
5509 | |
finally |
5510 | |
{ |
5511 | 2 | IOUtil.close( in ); |
5512 | 2 | IOUtil.close( out ); |
5513 | 2 | } |
5514 | |
|
5515 | 2 | return link; |
5516 | |
} |
5517 | |
|
5518 | |
|
5519 | |
|
5520 | |
|
5521 | |
|
5522 | |
|
5523 | |
|
5524 | |
|
5525 | |
private boolean isValidJavadocLink( String link ) |
5526 | |
{ |
5527 | |
try |
5528 | |
{ |
5529 | |
URI linkUri; |
5530 | 4 | if ( link.trim().toLowerCase( Locale.ENGLISH ).startsWith( "http:" ) || link.trim().toLowerCase( |
5531 | |
Locale.ENGLISH ).startsWith( "https:" ) || link.trim().toLowerCase( Locale.ENGLISH ).startsWith( |
5532 | |
"ftp:" ) || link.trim().toLowerCase( Locale.ENGLISH ).startsWith( "file:" ) ) |
5533 | |
{ |
5534 | 0 | linkUri = new URI( link + "/package-list" ); |
5535 | |
} |
5536 | |
else |
5537 | |
{ |
5538 | |
|
5539 | 4 | File dir = new File( link ); |
5540 | 4 | if ( !dir.isAbsolute() ) |
5541 | |
{ |
5542 | 0 | dir = new File( getOutputDirectory(), link ); |
5543 | |
} |
5544 | 4 | if ( !dir.isDirectory() ) |
5545 | |
{ |
5546 | 0 | getLog().error( "The given File link: " + dir + " is not a dir." ); |
5547 | |
} |
5548 | 4 | linkUri = new File( dir, "package-list" ).toURI(); |
5549 | |
} |
5550 | |
|
5551 | 4 | if ( !JavadocUtil.isValidPackageList( linkUri.toURL(), settings, validateLinks ) ) |
5552 | |
{ |
5553 | 0 | if ( getLog().isErrorEnabled() ) |
5554 | |
{ |
5555 | 0 | getLog().error( "Invalid link: " + link + "/package-list. Ignored it." ); |
5556 | |
} |
5557 | |
|
5558 | 0 | return false; |
5559 | |
} |
5560 | |
|
5561 | 4 | return true; |
5562 | |
} |
5563 | 0 | catch ( URISyntaxException e ) |
5564 | |
{ |
5565 | 0 | if ( getLog().isErrorEnabled() ) |
5566 | |
{ |
5567 | 0 | getLog().error( "Malformed link: " + link + "/package-list. Ignored it." ); |
5568 | |
} |
5569 | 0 | return false; |
5570 | |
} |
5571 | 0 | catch ( IOException e ) |
5572 | |
{ |
5573 | 0 | if ( getLog().isErrorEnabled() ) |
5574 | |
{ |
5575 | 0 | getLog().error( "Error fetching link: " + link + "/package-list. Ignored it." ); |
5576 | |
} |
5577 | 0 | return false; |
5578 | |
} |
5579 | |
} |
5580 | |
|
5581 | |
|
5582 | |
|
5583 | |
|
5584 | |
|
5585 | |
|
5586 | |
|
5587 | |
|
5588 | |
|
5589 | |
private void writeDebugJavadocScript( String cmdLine, File javadocOutputDirectory ) |
5590 | |
{ |
5591 | 74 | File commandLineFile = new File( javadocOutputDirectory, DEBUG_JAVADOC_SCRIPT_NAME ); |
5592 | 74 | commandLineFile.getParentFile().mkdirs(); |
5593 | |
|
5594 | |
try |
5595 | |
{ |
5596 | 74 | FileUtils.fileWrite( commandLineFile.getAbsolutePath(), null , cmdLine ); |
5597 | |
|
5598 | 74 | if ( !SystemUtils.IS_OS_WINDOWS ) |
5599 | |
{ |
5600 | 74 | Runtime.getRuntime().exec( new String[]{ "chmod", "a+x", commandLineFile.getAbsolutePath() } ); |
5601 | |
} |
5602 | |
} |
5603 | 0 | catch ( IOException e ) |
5604 | |
{ |
5605 | 0 | logError( "Unable to write '" + commandLineFile.getName() + "' debug script file", e ); |
5606 | 74 | } |
5607 | 74 | } |
5608 | |
|
5609 | |
|
5610 | |
|
5611 | |
|
5612 | |
|
5613 | |
|
5614 | |
|
5615 | |
|
5616 | |
|
5617 | |
private boolean isJavadocVMInitError( String output ) |
5618 | |
{ |
5619 | |
|
5620 | |
|
5621 | |
|
5622 | |
|
5623 | 0 | return !( output.contains( "Javadoc" ) || output.contains( "javadoc" ) ); |
5624 | |
} |
5625 | |
|
5626 | |
|
5627 | |
|
5628 | |
|
5629 | |
|
5630 | |
|
5631 | |
|
5632 | |
|
5633 | |
|
5634 | |
|
5635 | |
|
5636 | |
private static String getJavadocLink( MavenProject p ) |
5637 | |
{ |
5638 | 0 | if ( p.getUrl() == null ) |
5639 | |
{ |
5640 | 0 | return null; |
5641 | |
} |
5642 | |
|
5643 | 0 | String url = cleanUrl( p.getUrl() ); |
5644 | 0 | String destDir = "apidocs"; |
5645 | |
|
5646 | 0 | final String pluginId = "org.apache.maven.plugins:maven-javadoc-plugin"; |
5647 | 0 | String destDirConfigured = getPluginParameter( p, pluginId, "destDir" ); |
5648 | 0 | if ( destDirConfigured != null ) |
5649 | |
{ |
5650 | 0 | destDir = destDirConfigured; |
5651 | |
} |
5652 | |
|
5653 | 0 | return url + "/" + destDir; |
5654 | |
} |
5655 | |
|
5656 | |
|
5657 | |
|
5658 | |
|
5659 | |
|
5660 | |
|
5661 | |
private static String cleanUrl( String url ) |
5662 | |
{ |
5663 | 4 | if ( url == null ) |
5664 | |
{ |
5665 | 0 | return ""; |
5666 | |
} |
5667 | |
|
5668 | 4 | url = url.trim(); |
5669 | 6 | while ( url.endsWith( "/" ) ) |
5670 | |
{ |
5671 | 2 | url = url.substring( 0, url.lastIndexOf( "/" ) ); |
5672 | |
} |
5673 | |
|
5674 | 4 | return url; |
5675 | |
} |
5676 | |
|
5677 | |
|
5678 | |
|
5679 | |
|
5680 | |
|
5681 | |
|
5682 | |
|
5683 | |
|
5684 | |
|
5685 | |
private static Plugin getPlugin( MavenProject p, String pluginId ) |
5686 | |
{ |
5687 | 6 | if ( ( p.getBuild() == null ) || ( p.getBuild().getPluginsAsMap() == null ) ) |
5688 | |
{ |
5689 | 0 | return null; |
5690 | |
} |
5691 | |
|
5692 | 6 | Plugin plugin = (Plugin) p.getBuild().getPluginsAsMap().get( pluginId ); |
5693 | |
|
5694 | 6 | if ( ( plugin == null ) && ( p.getBuild().getPluginManagement() != null ) && ( |
5695 | |
p.getBuild().getPluginManagement().getPluginsAsMap() != null ) ) |
5696 | |
{ |
5697 | 0 | plugin = (Plugin) p.getBuild().getPluginManagement().getPluginsAsMap().get( pluginId ); |
5698 | |
} |
5699 | |
|
5700 | 6 | return plugin; |
5701 | |
} |
5702 | |
|
5703 | |
|
5704 | |
|
5705 | |
|
5706 | |
|
5707 | |
|
5708 | |
|
5709 | |
|
5710 | |
|
5711 | |
private static String getPluginParameter( MavenProject p, String pluginId, String param ) |
5712 | |
{ |
5713 | |
|
5714 | 2 | Plugin plugin = getPlugin( p, pluginId ); |
5715 | 2 | if ( plugin != null ) |
5716 | |
{ |
5717 | 0 | Xpp3Dom xpp3Dom = (Xpp3Dom) plugin.getConfiguration(); |
5718 | 0 | if ( xpp3Dom != null && xpp3Dom.getChild( param ) != null |
5719 | |
&& StringUtils.isNotEmpty( xpp3Dom.getChild( param ).getValue() ) ) |
5720 | |
{ |
5721 | 0 | return xpp3Dom.getChild( param ).getValue(); |
5722 | |
} |
5723 | |
} |
5724 | |
|
5725 | 2 | return null; |
5726 | |
} |
5727 | |
|
5728 | |
|
5729 | |
|
5730 | |
|
5731 | |
|
5732 | |
|
5733 | |
|
5734 | |
protected final File getJavadocOptionsFile() |
5735 | |
{ |
5736 | 90 | if ( javadocOptionsDir != null && !javadocOptionsDir.exists() ) |
5737 | |
{ |
5738 | 0 | javadocOptionsDir.mkdirs(); |
5739 | |
} |
5740 | |
|
5741 | 90 | return new File( javadocOptionsDir, "javadoc-options-" + getAttachmentClassifier() + ".xml" ); |
5742 | |
} |
5743 | |
|
5744 | |
|
5745 | |
|
5746 | |
|
5747 | |
|
5748 | |
|
5749 | |
|
5750 | |
|
5751 | |
protected final JavadocOptions buildJavadocOptions() |
5752 | |
throws IOException |
5753 | |
{ |
5754 | 88 | JavadocOptions options = new JavadocOptions(); |
5755 | |
|
5756 | 88 | options.setBootclasspathArtifacts( toList( bootclasspathArtifacts ) ); |
5757 | 88 | options.setDocfilesSubdirsUsed( docfilessubdirs ); |
5758 | 88 | options.setDocletArtifacts( toList( docletArtifact, docletArtifacts ) ); |
5759 | 88 | options.setExcludedDocfilesSubdirs( excludedocfilessubdir ); |
5760 | 88 | options.setExcludePackageNames( toList( excludePackageNames ) ); |
5761 | 88 | options.setGroups( toList( groups ) ); |
5762 | 88 | options.setLinks( links ); |
5763 | 88 | options.setOfflineLinks( toList( offlineLinks ) ); |
5764 | 88 | options.setResourcesArtifacts( toList( resourcesArtifacts ) ); |
5765 | 88 | options.setTagletArtifacts( toList( tagletArtifact, tagletArtifacts ) ); |
5766 | 88 | options.setTaglets( toList( taglets ) ); |
5767 | 88 | options.setTags( toList( tags ) ); |
5768 | |
|
5769 | 88 | if ( getProject() != null && getJavadocDirectory() != null ) |
5770 | |
{ |
5771 | 32 | options.setJavadocResourcesDirectory( |
5772 | |
toRelative( getProject().getBasedir(), getJavadocDirectory().getAbsolutePath() ) ); |
5773 | |
} |
5774 | |
|
5775 | 88 | File optionsFile = getJavadocOptionsFile(); |
5776 | 88 | Writer writer = null; |
5777 | |
try |
5778 | |
{ |
5779 | 88 | writer = WriterFactory.newXmlWriter( optionsFile ); |
5780 | 88 | new JavadocOptionsXpp3Writer().write( writer, options ); |
5781 | |
} |
5782 | |
finally |
5783 | |
{ |
5784 | 88 | close( writer ); |
5785 | 88 | } |
5786 | |
|
5787 | 88 | return options; |
5788 | |
} |
5789 | |
|
5790 | |
|
5791 | |
|
5792 | |
|
5793 | |
|
5794 | |
protected String getAttachmentClassifier() |
5795 | |
{ |
5796 | 90 | return JAVADOC_RESOURCES_ATTACHMENT_CLASSIFIER; |
5797 | |
} |
5798 | |
|
5799 | |
|
5800 | |
|
5801 | |
|
5802 | |
|
5803 | |
|
5804 | |
|
5805 | |
protected void logError( String message, Throwable t ) |
5806 | |
{ |
5807 | 0 | if ( getLog().isDebugEnabled() ) |
5808 | |
{ |
5809 | 0 | getLog().error( message, t ); |
5810 | |
} |
5811 | |
else |
5812 | |
{ |
5813 | 0 | getLog().error( message ); |
5814 | |
} |
5815 | 0 | } |
5816 | |
|
5817 | |
protected void failOnError( String prefix, Exception e ) |
5818 | |
throws MojoExecutionException |
5819 | |
{ |
5820 | 12 | if ( failOnError ) |
5821 | |
{ |
5822 | 12 | if ( e instanceof RuntimeException ) |
5823 | |
{ |
5824 | 0 | throw (RuntimeException) e; |
5825 | |
} |
5826 | 12 | throw new MojoExecutionException( prefix + ": " + e.getMessage(), e ); |
5827 | |
} |
5828 | |
|
5829 | 0 | getLog().error( prefix + ": " + e.getMessage(), e ); |
5830 | 0 | } |
5831 | |
} |