1 | |
package org.apache.maven.plugin; |
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 | |
|
19 | |
@SuppressWarnings( "all" ) |
20 | 0 | public class HelpMojo |
21 | |
extends AbstractMojo |
22 | |
{ |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
private boolean detail; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
private java.lang.String goal; |
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
private int lineLength; |
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
private int indentSize; |
50 | |
|
51 | |
|
52 | |
|
53 | |
public void execute() |
54 | |
throws MojoExecutionException |
55 | |
{ |
56 | 0 | if ( lineLength <= 0 ) |
57 | |
{ |
58 | 0 | getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." ); |
59 | 0 | lineLength = 80; |
60 | |
} |
61 | 0 | if ( indentSize <= 0 ) |
62 | |
{ |
63 | 0 | getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." ); |
64 | 0 | indentSize = 2; |
65 | |
} |
66 | |
|
67 | 0 | StringBuffer sb = new StringBuffer(); |
68 | |
|
69 | 0 | append( sb, "org.apache.maven.plugins:maven-compiler-plugin:2.5", 0 ); |
70 | 0 | append( sb, "", 0 ); |
71 | |
|
72 | 0 | append( sb, "Maven Compiler Plugin", 0 ); |
73 | 0 | append( sb, "The Compiler Plugin is used to compile the sources of your project.", 1 ); |
74 | 0 | append( sb, "", 0 ); |
75 | |
|
76 | 0 | if ( goal == null || goal.length() <= 0 ) |
77 | |
{ |
78 | 0 | append( sb, "This plugin has 3 goals:", 0 ); |
79 | 0 | append( sb, "", 0 ); |
80 | |
} |
81 | |
|
82 | 0 | if ( goal == null || goal.length() <= 0 || "compile".equals( goal ) ) |
83 | |
{ |
84 | 0 | append( sb, "compiler:compile", 0 ); |
85 | 0 | append( sb, "Compiles application sources", 1 ); |
86 | 0 | append( sb, "", 0 ); |
87 | 0 | if ( detail ) |
88 | |
{ |
89 | 0 | append( sb, "Available parameters:", 1 ); |
90 | 0 | append( sb, "", 0 ); |
91 | |
|
92 | 0 | append( sb, "annotationProcessors", 2 ); |
93 | 0 | append( sb, "Names of annotation processors to run. Only applies to JDK 1.6+ If not set, the default annotation processors discovery process applies.\n", 3 ); |
94 | 0 | append( sb, "", 0 ); |
95 | |
|
96 | 0 | append( sb, "compilerArgument", 2 ); |
97 | 0 | append( sb, "Sets the unformatted single argument string to be passed to the compiler if fork is set to true. To pass multiple arguments such as -Xmaxerrs 1000 (which are actually two arguments) you have to use compilerArguments.\n\nThis is because the list of valid arguments passed to a Java compiler varies based on the compiler version.\n", 3 ); |
98 | 0 | append( sb, "", 0 ); |
99 | |
|
100 | 0 | append( sb, "compilerArguments", 2 ); |
101 | 0 | append( sb, "Sets the arguments to be passed to the compiler (prepending a dash) if fork is set to true.\n\nThis is because the list of valid arguments passed to a Java compiler varies based on the compiler version.\n\nTo pass -Xmaxerrs 1000 -Xlint -Xlint:-path -Averbose=true you should include the following:\n\n<compilerArguments>\n\u00a0\u00a0<Xmaxerrs>1000</Xmaxerrs>\n\u00a0\u00a0<Xlint/>\n\u00a0\u00a0<Xlint:-path/>\n\u00a0\u00a0<Averbose>true</Averbose>\n</compilerArguments>\n", 3 ); |
102 | 0 | append( sb, "", 0 ); |
103 | |
|
104 | 0 | append( sb, "compilerId (Default: javac)", 2 ); |
105 | 0 | append( sb, "The compiler id of the compiler to use. See this guide for more information.", 3 ); |
106 | 0 | append( sb, "Expression: ${maven.compiler.compilerId}", 3 ); |
107 | 0 | append( sb, "", 0 ); |
108 | |
|
109 | 0 | append( sb, "compilerReuseStrategy (Default: ${reuseCreated})", 2 ); |
110 | 0 | append( sb, "Strategy to re use javacc class created:\n-\treuseCreated (default): will reuse already created but in case of multi-threaded builds, each thread will have its own instance\n-\treuseSame: the same Javacc class will be used for each compilation even for multi-threaded build\n-\talwaysNew: a new Javacc class will be created for each compilation\nNote this parameter value depends on the os/jdk you are using, but the default value should work on most of env.", 3 ); |
111 | 0 | append( sb, "Expression: ${maven.compiler.compilerReuseStrategy}", 3 ); |
112 | 0 | append( sb, "", 0 ); |
113 | |
|
114 | 0 | append( sb, "compilerVersion", 2 ); |
115 | 0 | append( sb, "Version of the compiler to use, ex. \'1.3\', \'1.5\', if fork is set to true.", 3 ); |
116 | 0 | append( sb, "Expression: ${maven.compiler.compilerVersion}", 3 ); |
117 | 0 | append( sb, "", 0 ); |
118 | |
|
119 | 0 | append( sb, "debug (Default: true)", 2 ); |
120 | 0 | append( sb, "Set to true to include debugging information in the compiled class files.", 3 ); |
121 | 0 | append( sb, "Expression: ${maven.compiler.debug}", 3 ); |
122 | 0 | append( sb, "", 0 ); |
123 | |
|
124 | 0 | append( sb, "debuglevel", 2 ); |
125 | 0 | append( sb, "Keyword list to be appended to the -g command-line switch. Legal values are none or a comma-separated list of the following keywords: lines, vars, and source. If debug level is not specified, by default, nothing will be appended to -g. If debug is not turned on, this attribute will be ignored.", 3 ); |
126 | 0 | append( sb, "Expression: ${maven.compiler.debuglevel}", 3 ); |
127 | 0 | append( sb, "", 0 ); |
128 | |
|
129 | 0 | append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); |
130 | 0 | append( sb, "The -encoding argument for the Java compiler.", 3 ); |
131 | 0 | append( sb, "Expression: ${encoding}", 3 ); |
132 | 0 | append( sb, "", 0 ); |
133 | |
|
134 | 0 | append( sb, "excludes", 2 ); |
135 | 0 | append( sb, "A list of exclusion filters for the compiler.", 3 ); |
136 | 0 | append( sb, "", 0 ); |
137 | |
|
138 | 0 | append( sb, "executable", 2 ); |
139 | 0 | append( sb, "Sets the executable of the compiler to use when fork is true.", 3 ); |
140 | 0 | append( sb, "Expression: ${maven.compiler.executable}", 3 ); |
141 | 0 | append( sb, "", 0 ); |
142 | |
|
143 | 0 | append( sb, "failOnError (Default: true)", 2 ); |
144 | 0 | append( sb, "Indicates whether the build will continue even if there are compilation errors.", 3 ); |
145 | 0 | append( sb, "Expression: ${maven.compiler.failOnError}", 3 ); |
146 | 0 | append( sb, "", 0 ); |
147 | |
|
148 | 0 | append( sb, "fork (Default: false)", 2 ); |
149 | 0 | append( sb, "Allows running the compiler in a separate process. If false it uses the built in compiler, while if true it will use an executable.", 3 ); |
150 | 0 | append( sb, "Expression: ${maven.compiler.fork}", 3 ); |
151 | 0 | append( sb, "", 0 ); |
152 | |
|
153 | 0 | append( sb, "generatedSourcesDirectory (Default: ${project.build.directory}/generated-sources/annotations)", 2 ); |
154 | 0 | append( sb, "Specify where to place generated source files created by annotation processing. Only applies to JDK 1.6+\n", 3 ); |
155 | 0 | append( sb, "", 0 ); |
156 | |
|
157 | 0 | append( sb, "includes", 2 ); |
158 | 0 | append( sb, "A list of inclusion filters for the compiler.", 3 ); |
159 | 0 | append( sb, "", 0 ); |
160 | |
|
161 | 0 | append( sb, "maxmem", 2 ); |
162 | 0 | append( sb, "Sets the maximum size, in megabytes, of the memory allocation pool, ex. \'128\', \'128m\' if fork is set to true.", 3 ); |
163 | 0 | append( sb, "Expression: ${maven.compiler.maxmem}", 3 ); |
164 | 0 | append( sb, "", 0 ); |
165 | |
|
166 | 0 | append( sb, "meminitial", 2 ); |
167 | 0 | append( sb, "Initial size, in megabytes, of the memory allocation pool, ex. \'64\', \'64m\' if fork is set to true.", 3 ); |
168 | 0 | append( sb, "Expression: ${maven.compiler.meminitial}", 3 ); |
169 | 0 | append( sb, "", 0 ); |
170 | |
|
171 | 0 | append( sb, "optimize (Default: false)", 2 ); |
172 | 0 | append( sb, "Set to true to optimize the compiled code using the compiler\'s optimization methods.", 3 ); |
173 | 0 | append( sb, "Expression: ${maven.compiler.optimize}", 3 ); |
174 | 0 | append( sb, "", 0 ); |
175 | |
|
176 | 0 | append( sb, "outputFileName", 2 ); |
177 | 0 | append( sb, "Sets the name of the output file when compiling a set of sources to a single file.", 3 ); |
178 | 0 | append( sb, "Expression: ${project.build.finalName}", 3 ); |
179 | 0 | append( sb, "", 0 ); |
180 | |
|
181 | 0 | append( sb, "proc", 2 ); |
182 | 0 | append( sb, "Sets whether annotation processing is performed or not. Only applies to JDK 1.6+ If not set, both compilation and annotation processing are performed at the same time.\n\nAllowed values are:\n\n-\tnone - no annotation processing is performed.\n-\tonly - only annotation processing is done, no compilation.\n", 3 ); |
183 | 0 | append( sb, "", 0 ); |
184 | |
|
185 | 0 | append( sb, "showDeprecation (Default: false)", 2 ); |
186 | 0 | append( sb, "Sets whether to show source locations where deprecated APIs are used.", 3 ); |
187 | 0 | append( sb, "Expression: ${maven.compiler.showDeprecation}", 3 ); |
188 | 0 | append( sb, "", 0 ); |
189 | |
|
190 | 0 | append( sb, "showWarnings (Default: false)", 2 ); |
191 | 0 | append( sb, "Set to true to show compilation warnings.", 3 ); |
192 | 0 | append( sb, "Expression: ${maven.compiler.showWarnings}", 3 ); |
193 | 0 | append( sb, "", 0 ); |
194 | |
|
195 | 0 | append( sb, "skipMultiThreadWarning (Default: ${false})", 2 ); |
196 | 0 | append( sb, "(no description available)", 3 ); |
197 | 0 | append( sb, "Expression: ${maven.compiler.skipMultiThreadWarning}", 3 ); |
198 | 0 | append( sb, "", 0 ); |
199 | |
|
200 | 0 | append( sb, "source (Default: 1.5)", 2 ); |
201 | 0 | append( sb, "The -source argument for the Java compiler.", 3 ); |
202 | 0 | append( sb, "Expression: ${maven.compiler.source}", 3 ); |
203 | 0 | append( sb, "", 0 ); |
204 | |
|
205 | 0 | append( sb, "staleMillis (Default: 0)", 2 ); |
206 | 0 | append( sb, "Sets the granularity in milliseconds of the last modification date for testing whether a source needs recompilation.", 3 ); |
207 | 0 | append( sb, "Expression: ${lastModGranularityMs}", 3 ); |
208 | 0 | append( sb, "", 0 ); |
209 | |
|
210 | 0 | append( sb, "target (Default: 1.5)", 2 ); |
211 | 0 | append( sb, "The -target argument for the Java compiler.", 3 ); |
212 | 0 | append( sb, "Expression: ${maven.compiler.target}", 3 ); |
213 | 0 | append( sb, "", 0 ); |
214 | |
|
215 | 0 | append( sb, "verbose (Default: false)", 2 ); |
216 | 0 | append( sb, "Set to true to show messages about what the compiler is doing.", 3 ); |
217 | 0 | append( sb, "Expression: ${maven.compiler.verbose}", 3 ); |
218 | 0 | append( sb, "", 0 ); |
219 | |
} |
220 | |
} |
221 | |
|
222 | 0 | if ( goal == null || goal.length() <= 0 || "help".equals( goal ) ) |
223 | |
{ |
224 | 0 | append( sb, "compiler:help", 0 ); |
225 | 0 | append( sb, "Display help information on maven-compiler-plugin.\nCall\n\u00a0\u00a0mvn\u00a0compiler:help\u00a0-Ddetail=true\u00a0-Dgoal=<goal-name>\nto display parameter details.", 1 ); |
226 | 0 | append( sb, "", 0 ); |
227 | 0 | if ( detail ) |
228 | |
{ |
229 | 0 | append( sb, "Available parameters:", 1 ); |
230 | 0 | append( sb, "", 0 ); |
231 | |
|
232 | 0 | append( sb, "detail (Default: false)", 2 ); |
233 | 0 | append( sb, "If true, display all settable properties for each goal.", 3 ); |
234 | 0 | append( sb, "Expression: ${detail}", 3 ); |
235 | 0 | append( sb, "", 0 ); |
236 | |
|
237 | 0 | append( sb, "goal", 2 ); |
238 | 0 | append( sb, "The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 ); |
239 | 0 | append( sb, "Expression: ${goal}", 3 ); |
240 | 0 | append( sb, "", 0 ); |
241 | |
|
242 | 0 | append( sb, "indentSize (Default: 2)", 2 ); |
243 | 0 | append( sb, "The number of spaces per indentation level, should be positive.", 3 ); |
244 | 0 | append( sb, "Expression: ${indentSize}", 3 ); |
245 | 0 | append( sb, "", 0 ); |
246 | |
|
247 | 0 | append( sb, "lineLength (Default: 80)", 2 ); |
248 | 0 | append( sb, "The maximum length of a display line, should be positive.", 3 ); |
249 | 0 | append( sb, "Expression: ${lineLength}", 3 ); |
250 | 0 | append( sb, "", 0 ); |
251 | |
} |
252 | |
} |
253 | |
|
254 | 0 | if ( goal == null || goal.length() <= 0 || "testCompile".equals( goal ) ) |
255 | |
{ |
256 | 0 | append( sb, "compiler:testCompile", 0 ); |
257 | 0 | append( sb, "Compiles application test sources.", 1 ); |
258 | 0 | append( sb, "", 0 ); |
259 | 0 | if ( detail ) |
260 | |
{ |
261 | 0 | append( sb, "Available parameters:", 1 ); |
262 | 0 | append( sb, "", 0 ); |
263 | |
|
264 | 0 | append( sb, "annotationProcessors", 2 ); |
265 | 0 | append( sb, "Names of annotation processors to run. Only applies to JDK 1.6+ If not set, the default annotation processors discovery process applies.\n", 3 ); |
266 | 0 | append( sb, "", 0 ); |
267 | |
|
268 | 0 | append( sb, "compilerArgument", 2 ); |
269 | 0 | append( sb, "Sets the unformatted single argument string to be passed to the compiler if fork is set to true. To pass multiple arguments such as -Xmaxerrs 1000 (which are actually two arguments) you have to use compilerArguments.\n\nThis is because the list of valid arguments passed to a Java compiler varies based on the compiler version.\n", 3 ); |
270 | 0 | append( sb, "", 0 ); |
271 | |
|
272 | 0 | append( sb, "compilerArguments", 2 ); |
273 | 0 | append( sb, "Sets the arguments to be passed to the compiler (prepending a dash) if fork is set to true.\n\nThis is because the list of valid arguments passed to a Java compiler varies based on the compiler version.\n\nTo pass -Xmaxerrs 1000 -Xlint -Xlint:-path -Averbose=true you should include the following:\n\n<compilerArguments>\n\u00a0\u00a0<Xmaxerrs>1000</Xmaxerrs>\n\u00a0\u00a0<Xlint/>\n\u00a0\u00a0<Xlint:-path/>\n\u00a0\u00a0<Averbose>true</Averbose>\n</compilerArguments>\n", 3 ); |
274 | 0 | append( sb, "", 0 ); |
275 | |
|
276 | 0 | append( sb, "compilerId (Default: javac)", 2 ); |
277 | 0 | append( sb, "The compiler id of the compiler to use. See this guide for more information.", 3 ); |
278 | 0 | append( sb, "Expression: ${maven.compiler.compilerId}", 3 ); |
279 | 0 | append( sb, "", 0 ); |
280 | |
|
281 | 0 | append( sb, "compilerReuseStrategy (Default: ${reuseCreated})", 2 ); |
282 | 0 | append( sb, "Strategy to re use javacc class created:\n-\treuseCreated (default): will reuse already created but in case of multi-threaded builds, each thread will have its own instance\n-\treuseSame: the same Javacc class will be used for each compilation even for multi-threaded build\n-\talwaysNew: a new Javacc class will be created for each compilation\nNote this parameter value depends on the os/jdk you are using, but the default value should work on most of env.", 3 ); |
283 | 0 | append( sb, "Expression: ${maven.compiler.compilerReuseStrategy}", 3 ); |
284 | 0 | append( sb, "", 0 ); |
285 | |
|
286 | 0 | append( sb, "compilerVersion", 2 ); |
287 | 0 | append( sb, "Version of the compiler to use, ex. \'1.3\', \'1.5\', if fork is set to true.", 3 ); |
288 | 0 | append( sb, "Expression: ${maven.compiler.compilerVersion}", 3 ); |
289 | 0 | append( sb, "", 0 ); |
290 | |
|
291 | 0 | append( sb, "debug (Default: true)", 2 ); |
292 | 0 | append( sb, "Set to true to include debugging information in the compiled class files.", 3 ); |
293 | 0 | append( sb, "Expression: ${maven.compiler.debug}", 3 ); |
294 | 0 | append( sb, "", 0 ); |
295 | |
|
296 | 0 | append( sb, "debuglevel", 2 ); |
297 | 0 | append( sb, "Keyword list to be appended to the -g command-line switch. Legal values are none or a comma-separated list of the following keywords: lines, vars, and source. If debug level is not specified, by default, nothing will be appended to -g. If debug is not turned on, this attribute will be ignored.", 3 ); |
298 | 0 | append( sb, "Expression: ${maven.compiler.debuglevel}", 3 ); |
299 | 0 | append( sb, "", 0 ); |
300 | |
|
301 | 0 | append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); |
302 | 0 | append( sb, "The -encoding argument for the Java compiler.", 3 ); |
303 | 0 | append( sb, "Expression: ${encoding}", 3 ); |
304 | 0 | append( sb, "", 0 ); |
305 | |
|
306 | 0 | append( sb, "executable", 2 ); |
307 | 0 | append( sb, "Sets the executable of the compiler to use when fork is true.", 3 ); |
308 | 0 | append( sb, "Expression: ${maven.compiler.executable}", 3 ); |
309 | 0 | append( sb, "", 0 ); |
310 | |
|
311 | 0 | append( sb, "failOnError (Default: true)", 2 ); |
312 | 0 | append( sb, "Indicates whether the build will continue even if there are compilation errors.", 3 ); |
313 | 0 | append( sb, "Expression: ${maven.compiler.failOnError}", 3 ); |
314 | 0 | append( sb, "", 0 ); |
315 | |
|
316 | 0 | append( sb, "fork (Default: false)", 2 ); |
317 | 0 | append( sb, "Allows running the compiler in a separate process. If false it uses the built in compiler, while if true it will use an executable.", 3 ); |
318 | 0 | append( sb, "Expression: ${maven.compiler.fork}", 3 ); |
319 | 0 | append( sb, "", 0 ); |
320 | |
|
321 | 0 | append( sb, "generatedTestSourcesDirectory (Default: ${project.build.directory}/generated-test-sources/test-annotations)", 2 ); |
322 | 0 | append( sb, "Specify where to place generated source files created by annotation processing. Only applies to JDK 1.6+\n", 3 ); |
323 | 0 | append( sb, "", 0 ); |
324 | |
|
325 | 0 | append( sb, "maxmem", 2 ); |
326 | 0 | append( sb, "Sets the maximum size, in megabytes, of the memory allocation pool, ex. \'128\', \'128m\' if fork is set to true.", 3 ); |
327 | 0 | append( sb, "Expression: ${maven.compiler.maxmem}", 3 ); |
328 | 0 | append( sb, "", 0 ); |
329 | |
|
330 | 0 | append( sb, "meminitial", 2 ); |
331 | 0 | append( sb, "Initial size, in megabytes, of the memory allocation pool, ex. \'64\', \'64m\' if fork is set to true.", 3 ); |
332 | 0 | append( sb, "Expression: ${maven.compiler.meminitial}", 3 ); |
333 | 0 | append( sb, "", 0 ); |
334 | |
|
335 | 0 | append( sb, "optimize (Default: false)", 2 ); |
336 | 0 | append( sb, "Set to true to optimize the compiled code using the compiler\'s optimization methods.", 3 ); |
337 | 0 | append( sb, "Expression: ${maven.compiler.optimize}", 3 ); |
338 | 0 | append( sb, "", 0 ); |
339 | |
|
340 | 0 | append( sb, "outputFileName", 2 ); |
341 | 0 | append( sb, "Sets the name of the output file when compiling a set of sources to a single file.", 3 ); |
342 | 0 | append( sb, "Expression: ${project.build.finalName}", 3 ); |
343 | 0 | append( sb, "", 0 ); |
344 | |
|
345 | 0 | append( sb, "proc", 2 ); |
346 | 0 | append( sb, "Sets whether annotation processing is performed or not. Only applies to JDK 1.6+ If not set, both compilation and annotation processing are performed at the same time.\n\nAllowed values are:\n\n-\tnone - no annotation processing is performed.\n-\tonly - only annotation processing is done, no compilation.\n", 3 ); |
347 | 0 | append( sb, "", 0 ); |
348 | |
|
349 | 0 | append( sb, "showDeprecation (Default: false)", 2 ); |
350 | 0 | append( sb, "Sets whether to show source locations where deprecated APIs are used.", 3 ); |
351 | 0 | append( sb, "Expression: ${maven.compiler.showDeprecation}", 3 ); |
352 | 0 | append( sb, "", 0 ); |
353 | |
|
354 | 0 | append( sb, "showWarnings (Default: false)", 2 ); |
355 | 0 | append( sb, "Set to true to show compilation warnings.", 3 ); |
356 | 0 | append( sb, "Expression: ${maven.compiler.showWarnings}", 3 ); |
357 | 0 | append( sb, "", 0 ); |
358 | |
|
359 | 0 | append( sb, "skip", 2 ); |
360 | 0 | append( sb, "Set this to \'true\' to bypass compilation of test sources. Its use is NOT RECOMMENDED, but quite convenient on occasion.", 3 ); |
361 | 0 | append( sb, "Expression: ${maven.test.skip}", 3 ); |
362 | 0 | append( sb, "", 0 ); |
363 | |
|
364 | 0 | append( sb, "skipMultiThreadWarning (Default: ${false})", 2 ); |
365 | 0 | append( sb, "(no description available)", 3 ); |
366 | 0 | append( sb, "Expression: ${maven.compiler.skipMultiThreadWarning}", 3 ); |
367 | 0 | append( sb, "", 0 ); |
368 | |
|
369 | 0 | append( sb, "source (Default: 1.5)", 2 ); |
370 | 0 | append( sb, "The -source argument for the Java compiler.", 3 ); |
371 | 0 | append( sb, "Expression: ${maven.compiler.source}", 3 ); |
372 | 0 | append( sb, "", 0 ); |
373 | |
|
374 | 0 | append( sb, "staleMillis (Default: 0)", 2 ); |
375 | 0 | append( sb, "Sets the granularity in milliseconds of the last modification date for testing whether a source needs recompilation.", 3 ); |
376 | 0 | append( sb, "Expression: ${lastModGranularityMs}", 3 ); |
377 | 0 | append( sb, "", 0 ); |
378 | |
|
379 | 0 | append( sb, "target (Default: 1.5)", 2 ); |
380 | 0 | append( sb, "The -target argument for the Java compiler.", 3 ); |
381 | 0 | append( sb, "Expression: ${maven.compiler.target}", 3 ); |
382 | 0 | append( sb, "", 0 ); |
383 | |
|
384 | 0 | append( sb, "testCompilerArgument", 2 ); |
385 | 0 | append( sb, "Sets the unformatted argument string to be passed to test compiler if fork is set to true.\n\nThis is because the list of valid arguments passed to a Java compiler varies based on the compiler version.\n", 3 ); |
386 | 0 | append( sb, "", 0 ); |
387 | |
|
388 | 0 | append( sb, "testCompilerArguments", 2 ); |
389 | 0 | append( sb, "Sets the arguments to be passed to test compiler (prepending a dash) if fork is set to true.\n\nThis is because the list of valid arguments passed to a Java compiler varies based on the compiler version.\n", 3 ); |
390 | 0 | append( sb, "", 0 ); |
391 | |
|
392 | 0 | append( sb, "testExcludes", 2 ); |
393 | 0 | append( sb, "A list of exclusion filters for the compiler.", 3 ); |
394 | 0 | append( sb, "", 0 ); |
395 | |
|
396 | 0 | append( sb, "testIncludes", 2 ); |
397 | 0 | append( sb, "A list of inclusion filters for the compiler.", 3 ); |
398 | 0 | append( sb, "", 0 ); |
399 | |
|
400 | 0 | append( sb, "testSource", 2 ); |
401 | 0 | append( sb, "The -source argument for the test Java compiler.", 3 ); |
402 | 0 | append( sb, "Expression: ${maven.compiler.testSource}", 3 ); |
403 | 0 | append( sb, "", 0 ); |
404 | |
|
405 | 0 | append( sb, "testTarget", 2 ); |
406 | 0 | append( sb, "The -target argument for the test Java compiler.", 3 ); |
407 | 0 | append( sb, "Expression: ${maven.compiler.testTarget}", 3 ); |
408 | 0 | append( sb, "", 0 ); |
409 | |
|
410 | 0 | append( sb, "verbose (Default: false)", 2 ); |
411 | 0 | append( sb, "Set to true to show messages about what the compiler is doing.", 3 ); |
412 | 0 | append( sb, "Expression: ${maven.compiler.verbose}", 3 ); |
413 | 0 | append( sb, "", 0 ); |
414 | |
} |
415 | |
} |
416 | |
|
417 | 0 | if ( getLog().isInfoEnabled() ) |
418 | |
{ |
419 | 0 | getLog().info( sb.toString() ); |
420 | |
} |
421 | 0 | } |
422 | |
|
423 | |
|
424 | |
|
425 | |
|
426 | |
|
427 | |
|
428 | |
|
429 | |
|
430 | |
|
431 | |
|
432 | |
private static String repeat( String str, int repeat ) |
433 | |
{ |
434 | 0 | StringBuffer buffer = new StringBuffer( repeat * str.length() ); |
435 | |
|
436 | 0 | for ( int i = 0; i < repeat; i++ ) |
437 | |
{ |
438 | 0 | buffer.append( str ); |
439 | |
} |
440 | |
|
441 | 0 | return buffer.toString(); |
442 | |
} |
443 | |
|
444 | |
|
445 | |
|
446 | |
|
447 | |
|
448 | |
|
449 | |
|
450 | |
|
451 | |
|
452 | |
private void append( StringBuffer sb, String description, int indent ) |
453 | |
{ |
454 | 0 | for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); ) |
455 | |
{ |
456 | 0 | sb.append( it.next().toString() ).append( '\n' ); |
457 | |
} |
458 | 0 | } |
459 | |
|
460 | |
|
461 | |
|
462 | |
|
463 | |
|
464 | |
|
465 | |
|
466 | |
|
467 | |
|
468 | |
|
469 | |
|
470 | |
private static List toLines( String text, int indent, int indentSize, int lineLength ) |
471 | |
{ |
472 | 0 | List<String> lines = new ArrayList<String>(); |
473 | |
|
474 | 0 | String ind = repeat( "\t", indent ); |
475 | 0 | String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" ); |
476 | 0 | for ( int i = 0; i < plainLines.length; i++ ) |
477 | |
{ |
478 | 0 | toLines( lines, ind + plainLines[i], indentSize, lineLength ); |
479 | |
} |
480 | |
|
481 | 0 | return lines; |
482 | |
} |
483 | |
|
484 | |
|
485 | |
|
486 | |
|
487 | |
|
488 | |
|
489 | |
|
490 | |
|
491 | |
|
492 | |
private static void toLines( List<String> lines, String line, int indentSize, int lineLength ) |
493 | |
{ |
494 | 0 | int lineIndent = getIndentLevel( line ); |
495 | 0 | StringBuffer buf = new StringBuffer( 256 ); |
496 | 0 | String[] tokens = line.split( " +" ); |
497 | 0 | for ( int i = 0; i < tokens.length; i++ ) |
498 | |
{ |
499 | 0 | String token = tokens[i]; |
500 | 0 | if ( i > 0 ) |
501 | |
{ |
502 | 0 | if ( buf.length() + token.length() >= lineLength ) |
503 | |
{ |
504 | 0 | lines.add( buf.toString() ); |
505 | 0 | buf.setLength( 0 ); |
506 | 0 | buf.append( repeat( " ", lineIndent * indentSize ) ); |
507 | |
} |
508 | |
else |
509 | |
{ |
510 | 0 | buf.append( ' ' ); |
511 | |
} |
512 | |
} |
513 | 0 | for ( int j = 0; j < token.length(); j++ ) |
514 | |
{ |
515 | 0 | char c = token.charAt( j ); |
516 | 0 | if ( c == '\t' ) |
517 | |
{ |
518 | 0 | buf.append( repeat( " ", indentSize - buf.length() % indentSize ) ); |
519 | |
} |
520 | 0 | else if ( c == '\u00A0' ) |
521 | |
{ |
522 | 0 | buf.append( ' ' ); |
523 | |
} |
524 | |
else |
525 | |
{ |
526 | 0 | buf.append( c ); |
527 | |
} |
528 | |
} |
529 | |
} |
530 | 0 | lines.add( buf.toString() ); |
531 | 0 | } |
532 | |
|
533 | |
|
534 | |
|
535 | |
|
536 | |
|
537 | |
|
538 | |
|
539 | |
private static int getIndentLevel( String line ) |
540 | |
{ |
541 | 0 | int level = 0; |
542 | 0 | for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ ) |
543 | |
{ |
544 | 0 | level++; |
545 | |
} |
546 | 0 | for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ ) |
547 | |
{ |
548 | 0 | if ( line.charAt( i ) == '\t' ) |
549 | |
{ |
550 | 0 | level++; |
551 | 0 | break; |
552 | |
} |
553 | |
} |
554 | 0 | return level; |
555 | |
} |
556 | |
} |