1 | |
package org.apache.maven.report.projectinfo; |
2 | |
|
3 | |
import java.util.ArrayList; |
4 | |
import java.util.Iterator; |
5 | |
import java.util.List; |
6 | |
|
7 | |
import org.apache.maven.plugin.AbstractMojo; |
8 | |
import org.apache.maven.plugin.MojoExecutionException; |
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | 0 | public class HelpMojo |
19 | |
extends AbstractMojo |
20 | |
{ |
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
private boolean detail; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
private java.lang.String goal; |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
private int lineLength; |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
private int indentSize; |
48 | |
|
49 | |
|
50 | |
|
51 | |
public void execute() |
52 | |
throws MojoExecutionException |
53 | |
{ |
54 | 0 | if ( lineLength <= 0 ) |
55 | |
{ |
56 | 0 | getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." ); |
57 | 0 | lineLength = 80; |
58 | |
} |
59 | 0 | if ( indentSize <= 0 ) |
60 | |
{ |
61 | 0 | getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." ); |
62 | 0 | indentSize = 2; |
63 | |
} |
64 | |
|
65 | 0 | StringBuffer sb = new StringBuffer(); |
66 | |
|
67 | 0 | append( sb, "org.apache.maven.plugins:maven-project-info-reports-plugin:2.3.1", 0 ); |
68 | 0 | append( sb, "", 0 ); |
69 | |
|
70 | 0 | append( sb, "Maven Project Info Reports Plugin", 0 ); |
71 | 0 | append( sb, "The Maven Project Info Reports Plugin is a plugin that generates standard reports for the specified project.", 1 ); |
72 | 0 | append( sb, "", 0 ); |
73 | |
|
74 | 0 | if ( goal == null || goal.length() <= 0 ) |
75 | |
{ |
76 | 0 | append( sb, "This plugin has 16 goals:", 0 ); |
77 | 0 | append( sb, "", 0 ); |
78 | |
} |
79 | |
|
80 | 0 | if ( goal == null || goal.length() <= 0 || "cim".equals( goal ) ) |
81 | |
{ |
82 | 0 | append( sb, "project-info-reports:cim", 0 ); |
83 | 0 | append( sb, "Generates the Project Continuous Integration System report.", 1 ); |
84 | 0 | append( sb, "", 0 ); |
85 | 0 | if ( detail ) |
86 | |
{ |
87 | 0 | append( sb, "Available parameters:", 1 ); |
88 | 0 | append( sb, "", 0 ); |
89 | |
|
90 | 0 | append( sb, "customBundle", 2 ); |
91 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
92 | 0 | append( sb, "", 0 ); |
93 | |
|
94 | 0 | append( sb, "outputDirectory", 2 ); |
95 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
96 | 0 | append( sb, "", 0 ); |
97 | |
} |
98 | |
} |
99 | |
|
100 | 0 | if ( goal == null || goal.length() <= 0 || "dependencies".equals( goal ) ) |
101 | |
{ |
102 | 0 | append( sb, "project-info-reports:dependencies", 0 ); |
103 | 0 | append( sb, "Generates the Project Dependencies report.", 1 ); |
104 | 0 | append( sb, "", 0 ); |
105 | 0 | if ( detail ) |
106 | |
{ |
107 | 0 | append( sb, "Available parameters:", 1 ); |
108 | 0 | append( sb, "", 0 ); |
109 | |
|
110 | 0 | append( sb, "customBundle", 2 ); |
111 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
112 | 0 | append( sb, "", 0 ); |
113 | |
|
114 | 0 | append( sb, "dependencyDetailsEnabled (Default: true)", 2 ); |
115 | 0 | append( sb, "Display file details for each dependency, such as: file size, number of classes, number of packages etc.", 3 ); |
116 | 0 | append( sb, "", 0 ); |
117 | |
|
118 | 0 | append( sb, "dependencyLocationsEnabled (Default: true)", 2 ); |
119 | 0 | append( sb, "Display the repository locations of the dependencies. If Maven is configured to be offline, this parameter will be ignored.", 3 ); |
120 | 0 | append( sb, "", 0 ); |
121 | |
|
122 | 0 | append( sb, "outputDirectory", 2 ); |
123 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
124 | 0 | append( sb, "", 0 ); |
125 | |
} |
126 | |
} |
127 | |
|
128 | 0 | if ( goal == null || goal.length() <= 0 || "dependency-convergence".equals( goal ) ) |
129 | |
{ |
130 | 0 | append( sb, "project-info-reports:dependency-convergence", 0 ); |
131 | 0 | append( sb, "Generates the Dependency Convergence report for reactor builds.", 1 ); |
132 | 0 | append( sb, "", 0 ); |
133 | 0 | if ( detail ) |
134 | |
{ |
135 | 0 | append( sb, "Available parameters:", 1 ); |
136 | 0 | append( sb, "", 0 ); |
137 | |
|
138 | 0 | append( sb, "customBundle", 2 ); |
139 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
140 | 0 | append( sb, "", 0 ); |
141 | |
|
142 | 0 | append( sb, "outputDirectory", 2 ); |
143 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
144 | 0 | append( sb, "", 0 ); |
145 | |
} |
146 | |
} |
147 | |
|
148 | 0 | if ( goal == null || goal.length() <= 0 || "dependency-management".equals( goal ) ) |
149 | |
{ |
150 | 0 | append( sb, "project-info-reports:dependency-management", 0 ); |
151 | 0 | append( sb, "Generates the Project Dependency Management report.", 1 ); |
152 | 0 | append( sb, "", 0 ); |
153 | 0 | if ( detail ) |
154 | |
{ |
155 | 0 | append( sb, "Available parameters:", 1 ); |
156 | 0 | append( sb, "", 0 ); |
157 | |
|
158 | 0 | append( sb, "customBundle", 2 ); |
159 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
160 | 0 | append( sb, "", 0 ); |
161 | |
|
162 | 0 | append( sb, "outputDirectory", 2 ); |
163 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
164 | 0 | append( sb, "", 0 ); |
165 | |
|
166 | 0 | append( sb, "remoteRepositories", 2 ); |
167 | 0 | append( sb, "Remote repositories used for the project.", 3 ); |
168 | 0 | append( sb, "", 0 ); |
169 | |
} |
170 | |
} |
171 | |
|
172 | 0 | if ( goal == null || goal.length() <= 0 || "distribution-management".equals( goal ) ) |
173 | |
{ |
174 | 0 | append( sb, "project-info-reports:distribution-management", 0 ); |
175 | 0 | append( sb, "Generates the Project Distribution Management report.", 1 ); |
176 | 0 | append( sb, "", 0 ); |
177 | 0 | if ( detail ) |
178 | |
{ |
179 | 0 | append( sb, "Available parameters:", 1 ); |
180 | 0 | append( sb, "", 0 ); |
181 | |
|
182 | 0 | append( sb, "customBundle", 2 ); |
183 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
184 | 0 | append( sb, "", 0 ); |
185 | |
|
186 | 0 | append( sb, "outputDirectory", 2 ); |
187 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
188 | 0 | append( sb, "", 0 ); |
189 | |
} |
190 | |
} |
191 | |
|
192 | 0 | if ( goal == null || goal.length() <= 0 || "help".equals( goal ) ) |
193 | |
{ |
194 | 0 | append( sb, "project-info-reports:help", 0 ); |
195 | 0 | append( sb, "Display help information on maven-project-info-reports-plugin.\nCall\n\u00a0\u00a0mvn\u00a0project-info-reports:help\u00a0-Ddetail=true\u00a0-Dgoal=<goal-name>\nto display parameter details.", 1 ); |
196 | 0 | append( sb, "", 0 ); |
197 | 0 | if ( detail ) |
198 | |
{ |
199 | 0 | append( sb, "Available parameters:", 1 ); |
200 | 0 | append( sb, "", 0 ); |
201 | |
|
202 | 0 | append( sb, "detail (Default: false)", 2 ); |
203 | 0 | append( sb, "If true, display all settable properties for each goal.", 3 ); |
204 | 0 | append( sb, "", 0 ); |
205 | |
|
206 | 0 | append( sb, "goal", 2 ); |
207 | 0 | append( sb, "The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 ); |
208 | 0 | append( sb, "", 0 ); |
209 | |
|
210 | 0 | append( sb, "indentSize (Default: 2)", 2 ); |
211 | 0 | append( sb, "The number of spaces per indentation level, should be positive.", 3 ); |
212 | 0 | append( sb, "", 0 ); |
213 | |
|
214 | 0 | append( sb, "lineLength (Default: 80)", 2 ); |
215 | 0 | append( sb, "The maximum length of a display line, should be positive.", 3 ); |
216 | 0 | append( sb, "", 0 ); |
217 | |
} |
218 | |
} |
219 | |
|
220 | 0 | if ( goal == null || goal.length() <= 0 || "index".equals( goal ) ) |
221 | |
{ |
222 | 0 | append( sb, "project-info-reports:index", 0 ); |
223 | 0 | append( sb, "Generates the project index page.", 1 ); |
224 | 0 | append( sb, "", 0 ); |
225 | 0 | if ( detail ) |
226 | |
{ |
227 | 0 | append( sb, "Available parameters:", 1 ); |
228 | 0 | append( sb, "", 0 ); |
229 | |
|
230 | 0 | append( sb, "customBundle", 2 ); |
231 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
232 | 0 | append( sb, "", 0 ); |
233 | |
|
234 | 0 | append( sb, "outputDirectory", 2 ); |
235 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
236 | 0 | append( sb, "", 0 ); |
237 | |
} |
238 | |
} |
239 | |
|
240 | 0 | if ( goal == null || goal.length() <= 0 || "issue-tracking".equals( goal ) ) |
241 | |
{ |
242 | 0 | append( sb, "project-info-reports:issue-tracking", 0 ); |
243 | 0 | append( sb, "Generates the Project Issue Tracking report.", 1 ); |
244 | 0 | append( sb, "", 0 ); |
245 | 0 | if ( detail ) |
246 | |
{ |
247 | 0 | append( sb, "Available parameters:", 1 ); |
248 | 0 | append( sb, "", 0 ); |
249 | |
|
250 | 0 | append( sb, "customBundle", 2 ); |
251 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
252 | 0 | append( sb, "", 0 ); |
253 | |
|
254 | 0 | append( sb, "outputDirectory", 2 ); |
255 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
256 | 0 | append( sb, "", 0 ); |
257 | |
} |
258 | |
} |
259 | |
|
260 | 0 | if ( goal == null || goal.length() <= 0 || "license".equals( goal ) ) |
261 | |
{ |
262 | 0 | append( sb, "project-info-reports:license", 0 ); |
263 | 0 | append( sb, "Generates the Project License report.", 1 ); |
264 | 0 | append( sb, "", 0 ); |
265 | 0 | if ( detail ) |
266 | |
{ |
267 | 0 | append( sb, "Available parameters:", 1 ); |
268 | 0 | append( sb, "", 0 ); |
269 | |
|
270 | 0 | append( sb, "customBundle", 2 ); |
271 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
272 | 0 | append( sb, "", 0 ); |
273 | |
|
274 | 0 | append( sb, "linkOnly (Default: false)", 2 ); |
275 | 0 | append( sb, "Whether the only render links to the license documents instead of inlining them.\nIf the system is in offline mode, the linkOnly parameter will be always true.", 3 ); |
276 | 0 | append( sb, "", 0 ); |
277 | |
|
278 | 0 | append( sb, "offline", 2 ); |
279 | 0 | append( sb, "Whether the system is currently offline.", 3 ); |
280 | 0 | append( sb, "", 0 ); |
281 | |
|
282 | 0 | append( sb, "outputDirectory", 2 ); |
283 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
284 | 0 | append( sb, "", 0 ); |
285 | |
} |
286 | |
} |
287 | |
|
288 | 0 | if ( goal == null || goal.length() <= 0 || "mailing-list".equals( goal ) ) |
289 | |
{ |
290 | 0 | append( sb, "project-info-reports:mailing-list", 0 ); |
291 | 0 | append( sb, "Generates the Mailing List report.", 1 ); |
292 | 0 | append( sb, "", 0 ); |
293 | 0 | if ( detail ) |
294 | |
{ |
295 | 0 | append( sb, "Available parameters:", 1 ); |
296 | 0 | append( sb, "", 0 ); |
297 | |
|
298 | 0 | append( sb, "customBundle", 2 ); |
299 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
300 | 0 | append( sb, "", 0 ); |
301 | |
|
302 | 0 | append( sb, "introduction", 2 ); |
303 | 0 | append( sb, "Deprecated. since 2.3, you should use a custom bundle.", 3 ); |
304 | 0 | append( sb, "", 0 ); |
305 | 0 | append( sb, "This can override the header text of the mailing list(s) report", 3 ); |
306 | 0 | append( sb, "", 0 ); |
307 | |
|
308 | 0 | append( sb, "outputDirectory", 2 ); |
309 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
310 | 0 | append( sb, "", 0 ); |
311 | |
} |
312 | |
} |
313 | |
|
314 | 0 | if ( goal == null || goal.length() <= 0 || "modules".equals( goal ) ) |
315 | |
{ |
316 | 0 | append( sb, "project-info-reports:modules", 0 ); |
317 | 0 | append( sb, "Generates the Project Modules report.", 1 ); |
318 | 0 | append( sb, "", 0 ); |
319 | 0 | if ( detail ) |
320 | |
{ |
321 | 0 | append( sb, "Available parameters:", 1 ); |
322 | 0 | append( sb, "", 0 ); |
323 | |
|
324 | 0 | append( sb, "customBundle", 2 ); |
325 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
326 | 0 | append( sb, "", 0 ); |
327 | |
|
328 | 0 | append( sb, "outputDirectory", 2 ); |
329 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
330 | 0 | append( sb, "", 0 ); |
331 | |
} |
332 | |
} |
333 | |
|
334 | 0 | if ( goal == null || goal.length() <= 0 || "plugin-management".equals( goal ) ) |
335 | |
{ |
336 | 0 | append( sb, "project-info-reports:plugin-management", 0 ); |
337 | 0 | append( sb, "Generates the Project Plugin Management report.", 1 ); |
338 | 0 | append( sb, "", 0 ); |
339 | 0 | if ( detail ) |
340 | |
{ |
341 | 0 | append( sb, "Available parameters:", 1 ); |
342 | 0 | append( sb, "", 0 ); |
343 | |
|
344 | 0 | append( sb, "customBundle", 2 ); |
345 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
346 | 0 | append( sb, "", 0 ); |
347 | |
|
348 | 0 | append( sb, "outputDirectory", 2 ); |
349 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
350 | 0 | append( sb, "", 0 ); |
351 | |
} |
352 | |
} |
353 | |
|
354 | 0 | if ( goal == null || goal.length() <= 0 || "plugins".equals( goal ) ) |
355 | |
{ |
356 | 0 | append( sb, "project-info-reports:plugins", 0 ); |
357 | 0 | append( sb, "Generates the Project Plugins report.", 1 ); |
358 | 0 | append( sb, "", 0 ); |
359 | 0 | if ( detail ) |
360 | |
{ |
361 | 0 | append( sb, "Available parameters:", 1 ); |
362 | 0 | append( sb, "", 0 ); |
363 | |
|
364 | 0 | append( sb, "customBundle", 2 ); |
365 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
366 | 0 | append( sb, "", 0 ); |
367 | |
|
368 | 0 | append( sb, "outputDirectory", 2 ); |
369 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
370 | 0 | append( sb, "", 0 ); |
371 | |
} |
372 | |
} |
373 | |
|
374 | 0 | if ( goal == null || goal.length() <= 0 || "project-team".equals( goal ) ) |
375 | |
{ |
376 | 0 | append( sb, "project-info-reports:project-team", 0 ); |
377 | 0 | append( sb, "Generates the Project Team report.", 1 ); |
378 | 0 | append( sb, "", 0 ); |
379 | 0 | if ( detail ) |
380 | |
{ |
381 | 0 | append( sb, "Available parameters:", 1 ); |
382 | 0 | append( sb, "", 0 ); |
383 | |
|
384 | 0 | append( sb, "customBundle", 2 ); |
385 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
386 | 0 | append( sb, "", 0 ); |
387 | |
|
388 | 0 | append( sb, "outputDirectory", 2 ); |
389 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
390 | 0 | append( sb, "", 0 ); |
391 | |
} |
392 | |
} |
393 | |
|
394 | 0 | if ( goal == null || goal.length() <= 0 || "scm".equals( goal ) ) |
395 | |
{ |
396 | 0 | append( sb, "project-info-reports:scm", 0 ); |
397 | 0 | append( sb, "Generates the Project Source Code Management (SCM) report.", 1 ); |
398 | 0 | append( sb, "", 0 ); |
399 | 0 | if ( detail ) |
400 | |
{ |
401 | 0 | append( sb, "Available parameters:", 1 ); |
402 | 0 | append( sb, "", 0 ); |
403 | |
|
404 | 0 | append( sb, "anonymousConnection (Default: ${project.scm.connection})", 2 ); |
405 | 0 | append( sb, "The SCM anonymous connection url respecting the SCM URL Format.", 3 ); |
406 | 0 | append( sb, "", 0 ); |
407 | |
|
408 | 0 | append( sb, "checkoutDirectoryName (Default: ${project.artifactId})", 2 ); |
409 | 0 | append( sb, "The directory name to checkout right after the SCM URL.", 3 ); |
410 | 0 | append( sb, "", 0 ); |
411 | |
|
412 | 0 | append( sb, "customBundle", 2 ); |
413 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
414 | 0 | append( sb, "", 0 ); |
415 | |
|
416 | 0 | append( sb, "developerConnection (Default: ${project.scm.developerConnection})", 2 ); |
417 | 0 | append( sb, "The SCM developer connection url respecting the SCM URL Format.", 3 ); |
418 | 0 | append( sb, "", 0 ); |
419 | |
|
420 | 0 | append( sb, "outputDirectory", 2 ); |
421 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
422 | 0 | append( sb, "", 0 ); |
423 | |
|
424 | 0 | append( sb, "webAccessUrl (Default: ${project.scm.url})", 2 ); |
425 | 0 | append( sb, "The SCM web access url.", 3 ); |
426 | 0 | append( sb, "", 0 ); |
427 | |
} |
428 | |
} |
429 | |
|
430 | 0 | if ( goal == null || goal.length() <= 0 || "summary".equals( goal ) ) |
431 | |
{ |
432 | 0 | append( sb, "project-info-reports:summary", 0 ); |
433 | 0 | append( sb, "Generates the project information reports summary.", 1 ); |
434 | 0 | append( sb, "", 0 ); |
435 | 0 | if ( detail ) |
436 | |
{ |
437 | 0 | append( sb, "Available parameters:", 1 ); |
438 | 0 | append( sb, "", 0 ); |
439 | |
|
440 | 0 | append( sb, "customBundle", 2 ); |
441 | 0 | append( sb, "Path for a custom bundle instead of using the default one.\nUsing this field, you could change the texts in the generated reports.", 3 ); |
442 | 0 | append( sb, "", 0 ); |
443 | |
|
444 | 0 | append( sb, "outputDirectory", 2 ); |
445 | 0 | append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 ); |
446 | 0 | append( sb, "", 0 ); |
447 | |
} |
448 | |
} |
449 | |
|
450 | 0 | if ( getLog().isInfoEnabled() ) |
451 | |
{ |
452 | 0 | getLog().info( sb.toString() ); |
453 | |
} |
454 | 0 | } |
455 | |
|
456 | |
|
457 | |
|
458 | |
|
459 | |
|
460 | |
|
461 | |
|
462 | |
|
463 | |
|
464 | |
|
465 | |
private static String repeat( String str, int repeat ) |
466 | |
{ |
467 | 0 | StringBuffer buffer = new StringBuffer( repeat * str.length() ); |
468 | |
|
469 | 0 | for ( int i = 0; i < repeat; i++ ) |
470 | |
{ |
471 | 0 | buffer.append( str ); |
472 | |
} |
473 | |
|
474 | 0 | return buffer.toString(); |
475 | |
} |
476 | |
|
477 | |
|
478 | |
|
479 | |
|
480 | |
|
481 | |
|
482 | |
|
483 | |
|
484 | |
|
485 | |
private void append( StringBuffer sb, String description, int indent ) |
486 | |
{ |
487 | 0 | for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); ) |
488 | |
{ |
489 | 0 | sb.append( it.next().toString() ).append( '\n' ); |
490 | |
} |
491 | 0 | } |
492 | |
|
493 | |
|
494 | |
|
495 | |
|
496 | |
|
497 | |
|
498 | |
|
499 | |
|
500 | |
|
501 | |
|
502 | |
|
503 | |
private static List toLines( String text, int indent, int indentSize, int lineLength ) |
504 | |
{ |
505 | 0 | List lines = new ArrayList(); |
506 | |
|
507 | 0 | String ind = repeat( "\t", indent ); |
508 | 0 | String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" ); |
509 | 0 | for ( int i = 0; i < plainLines.length; i++ ) |
510 | |
{ |
511 | 0 | toLines( lines, ind + plainLines[i], indentSize, lineLength ); |
512 | |
} |
513 | |
|
514 | 0 | return lines; |
515 | |
} |
516 | |
|
517 | |
|
518 | |
|
519 | |
|
520 | |
|
521 | |
|
522 | |
|
523 | |
|
524 | |
|
525 | |
private static void toLines( List lines, String line, int indentSize, int lineLength ) |
526 | |
{ |
527 | 0 | int lineIndent = getIndentLevel( line ); |
528 | 0 | StringBuffer buf = new StringBuffer( 256 ); |
529 | 0 | String[] tokens = line.split( " +" ); |
530 | 0 | for ( int i = 0; i < tokens.length; i++ ) |
531 | |
{ |
532 | 0 | String token = tokens[i]; |
533 | 0 | if ( i > 0 ) |
534 | |
{ |
535 | 0 | if ( buf.length() + token.length() >= lineLength ) |
536 | |
{ |
537 | 0 | lines.add( buf.toString() ); |
538 | 0 | buf.setLength( 0 ); |
539 | 0 | buf.append( repeat( " ", lineIndent * indentSize ) ); |
540 | |
} |
541 | |
else |
542 | |
{ |
543 | 0 | buf.append( ' ' ); |
544 | |
} |
545 | |
} |
546 | 0 | for ( int j = 0; j < token.length(); j++ ) |
547 | |
{ |
548 | 0 | char c = token.charAt( j ); |
549 | 0 | if ( c == '\t' ) |
550 | |
{ |
551 | 0 | buf.append( repeat( " ", indentSize - buf.length() % indentSize ) ); |
552 | |
} |
553 | 0 | else if ( c == '\u00A0' ) |
554 | |
{ |
555 | 0 | buf.append( ' ' ); |
556 | |
} |
557 | |
else |
558 | |
{ |
559 | 0 | buf.append( c ); |
560 | |
} |
561 | |
} |
562 | |
} |
563 | 0 | lines.add( buf.toString() ); |
564 | 0 | } |
565 | |
|
566 | |
|
567 | |
|
568 | |
|
569 | |
|
570 | |
|
571 | |
|
572 | |
private static int getIndentLevel( String line ) |
573 | |
{ |
574 | 0 | int level = 0; |
575 | 0 | for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ ) |
576 | |
{ |
577 | 0 | level++; |
578 | |
} |
579 | 0 | for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ ) |
580 | |
{ |
581 | 0 | if ( line.charAt( i ) == '\t' ) |
582 | |
{ |
583 | 0 | level++; |
584 | 0 | break; |
585 | |
} |
586 | |
} |
587 | 0 | return level; |
588 | |
} |
589 | |
} |