1 | |
package org.apache.maven.archetype.mojos; |
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-archetype-plugin:2.2", 0 ); |
70 | 0 | append( sb, "", 0 ); |
71 | |
|
72 | 0 | append( sb, "Maven Archetype Plugin", 0 ); |
73 | 0 | append( sb, "Maven Archetype is a set of tools to deal with archetypes, i.e. an abstract representation of a kind of project that can be instantiated into a concrete customized Maven project. An archetype knows which files will be part of the instantiated project and which properties to fill to properly customize the project.", 1 ); |
74 | 0 | append( sb, "", 0 ); |
75 | |
|
76 | 0 | if ( goal == null || goal.length() <= 0 ) |
77 | |
{ |
78 | 0 | append( sb, "This plugin has 8 goals:", 0 ); |
79 | 0 | append( sb, "", 0 ); |
80 | |
} |
81 | |
|
82 | 0 | if ( goal == null || goal.length() <= 0 || "crawl".equals( goal ) ) |
83 | |
{ |
84 | 0 | append( sb, "archetype:crawl", 0 ); |
85 | 0 | append( sb, "Crawl a Maven repository (filesystem, not HTTP) and creates a catalog file.", 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, "catalogFile", 2 ); |
93 | 0 | append( sb, "The archetype\'s catalog to update.", 3 ); |
94 | 0 | append( sb, "Expression: ${catalog}", 3 ); |
95 | 0 | append( sb, "", 0 ); |
96 | |
|
97 | 0 | append( sb, "repository (Default: ${settings.localRepository})", 2 ); |
98 | 0 | append( sb, "The repository to crawl.", 3 ); |
99 | 0 | append( sb, "Expression: ${repository}", 3 ); |
100 | 0 | append( sb, "", 0 ); |
101 | |
} |
102 | |
} |
103 | |
|
104 | 0 | if ( goal == null || goal.length() <= 0 || "create".equals( goal ) ) |
105 | |
{ |
106 | 0 | append( sb, "archetype:create", 0 ); |
107 | 0 | append( sb, "Deprecated. Please use the generate mojo instead.", 1 ); |
108 | 0 | if ( detail ) |
109 | |
{ |
110 | 0 | append( sb, "", 0 ); |
111 | 0 | append( sb, "The archetype creation goal looks for an archetype with a given groupId, artifactId, and version and retrieves it from the remote repository. Once the archetype is retrieved, it is then processed against a set of user parameters to create a working Maven project.", 1 ); |
112 | |
} |
113 | 0 | append( sb, "", 0 ); |
114 | 0 | if ( detail ) |
115 | |
{ |
116 | 0 | append( sb, "Available parameters:", 1 ); |
117 | 0 | append( sb, "", 0 ); |
118 | |
|
119 | 0 | append( sb, "archetypeArtifactId (Default: maven-archetype-quickstart)", 2 ); |
120 | 0 | append( sb, "The Archetype Artifact Id to be used.", 3 ); |
121 | 0 | append( sb, "Required: Yes", 3 ); |
122 | 0 | append( sb, "Expression: ${archetypeArtifactId}", 3 ); |
123 | 0 | append( sb, "", 0 ); |
124 | |
|
125 | 0 | append( sb, "archetypeGroupId (Default: org.apache.maven.archetypes)", 2 ); |
126 | 0 | append( sb, "The Archetype Group Id to be used.", 3 ); |
127 | 0 | append( sb, "Required: Yes", 3 ); |
128 | 0 | append( sb, "Expression: ${archetypeGroupId}", 3 ); |
129 | 0 | append( sb, "", 0 ); |
130 | |
|
131 | 0 | append( sb, "archetypeVersion (Default: RELEASE)", 2 ); |
132 | 0 | append( sb, "The Archetype Version to be used.", 3 ); |
133 | 0 | append( sb, "Required: Yes", 3 ); |
134 | 0 | append( sb, "Expression: ${archetypeVersion}", 3 ); |
135 | 0 | append( sb, "", 0 ); |
136 | |
|
137 | 0 | append( sb, "artifactId", 2 ); |
138 | 0 | append( sb, "The Artifact Id of the project to be build.", 3 ); |
139 | 0 | append( sb, "Expression: ${artifactId}", 3 ); |
140 | 0 | append( sb, "", 0 ); |
141 | |
|
142 | 0 | append( sb, "basedir (Default: ${user.dir})", 2 ); |
143 | 0 | append( sb, "(no description available)", 3 ); |
144 | 0 | append( sb, "Expression: ${basedir}", 3 ); |
145 | 0 | append( sb, "", 0 ); |
146 | |
|
147 | 0 | append( sb, "groupId", 2 ); |
148 | 0 | append( sb, "The Group Id of the project to be build.", 3 ); |
149 | 0 | append( sb, "Expression: ${groupId}", 3 ); |
150 | 0 | append( sb, "", 0 ); |
151 | |
|
152 | 0 | append( sb, "localRepository", 2 ); |
153 | 0 | append( sb, "Maven\'s local repository.", 3 ); |
154 | 0 | append( sb, "Required: Yes", 3 ); |
155 | 0 | append( sb, "Expression: ${localRepository}", 3 ); |
156 | 0 | append( sb, "", 0 ); |
157 | |
|
158 | 0 | append( sb, "packageName", 2 ); |
159 | 0 | append( sb, "The Package Name of the project to be build.", 3 ); |
160 | 0 | append( sb, "Expression: ${packageName}", 3 ); |
161 | 0 | append( sb, "", 0 ); |
162 | |
|
163 | 0 | append( sb, "pomRemoteRepositories", 2 ); |
164 | 0 | append( sb, "The remote repositories available for discovering dependencies and extensions as indicated by the POM.", 3 ); |
165 | 0 | append( sb, "Required: Yes", 3 ); |
166 | 0 | append( sb, "Expression: ${project.remoteArtifactRepositories}", 3 ); |
167 | 0 | append( sb, "", 0 ); |
168 | |
|
169 | 0 | append( sb, "project", 2 ); |
170 | 0 | append( sb, "The project to be created an archetype of.", 3 ); |
171 | 0 | append( sb, "Expression: ${project}", 3 ); |
172 | 0 | append( sb, "", 0 ); |
173 | |
|
174 | 0 | append( sb, "remoteRepositories", 2 ); |
175 | 0 | append( sb, "Other remote repositories available for discovering dependencies and extensions.", 3 ); |
176 | 0 | append( sb, "Expression: ${remoteRepositories}", 3 ); |
177 | 0 | append( sb, "", 0 ); |
178 | |
|
179 | 0 | append( sb, "version (Default: 1.0-SNAPSHOT)", 2 ); |
180 | 0 | append( sb, "The Version of the project to be build.", 3 ); |
181 | 0 | append( sb, "Required: Yes", 3 ); |
182 | 0 | append( sb, "Expression: ${version}", 3 ); |
183 | 0 | append( sb, "", 0 ); |
184 | |
} |
185 | |
} |
186 | |
|
187 | 0 | if ( goal == null || goal.length() <= 0 || "create-from-project".equals( goal ) ) |
188 | |
{ |
189 | 0 | append( sb, "archetype:create-from-project", 0 ); |
190 | 0 | append( sb, "Creates an archetype project from the current project.\n\nThis goal reads your source and resource files, the values of its parameters, and properties you specify in a .property file, and uses them to create a Maven archetype project using the maven-archetype packaging. If you build the resulting project, it will create the archetype. You can then use this archetype to create new projects that resemble the original.\n\nThe maven-archetype-plugin uses Velocity to expand template files, and this documentation talks about \'Velocity Properties\', which are values substituted into Velocity templates. See The Velocity User\'s Guide for more information.\n\nThis goal modifies the text of the files of the current project to form the Velocity template files that make up the archetype.\n\nGAV\n\tThe GAV values for the current project are replaced by properties: groupId, artifactId, and version. The user chooses new values for these when generating a project from the archetype.\npackage\n\tAll the files under one specified Java (or cognate) package are relocated to a project that the user chooses when generating a project. References to the class name are replaced by a property reference. For example, if the current project\'s sources are in the package org.apache.saltedpeanuts, then any example of the string org.apache.saltedpeanuts is replaced with the Velocity property reference ${packageName}. When the user generates a project, this is in turn replaced by his or her choice of a package.\ncustom properties\n\tYou may identify additional strings that should be replaced by parameters. To add custom properties, you must use the propertyFile parameter to specify a property file. See the documentation for propertyFile for the details.\n\nNote that you may need to edit the results of this goal. This goal has no way to exclude unwanted files, or add copyright notices to the Velocity templates, or add more complex elements to the archetype metadata file.\n\nThis goal also generates a simple integration-test that exercises the generated archetype.\n", 1 ); |
191 | 0 | append( sb, "", 0 ); |
192 | 0 | if ( detail ) |
193 | |
{ |
194 | 0 | append( sb, "Available parameters:", 1 ); |
195 | 0 | append( sb, "", 0 ); |
196 | |
|
197 | 0 | append( sb, "archetypeFilteredExtentions", 2 ); |
198 | 0 | append( sb, "File extensions which are checked for project\'s text files (vs binary files).", 3 ); |
199 | 0 | append( sb, "Expression: ${archetype.filteredExtentions}", 3 ); |
200 | 0 | append( sb, "", 0 ); |
201 | |
|
202 | 0 | append( sb, "archetypeLanguages", 2 ); |
203 | 0 | append( sb, "Directory names which are checked for project\'s sources main package.", 3 ); |
204 | 0 | append( sb, "Expression: ${archetype.languages}", 3 ); |
205 | 0 | append( sb, "", 0 ); |
206 | |
|
207 | 0 | append( sb, "archetypePostPhase (Default: package)", 2 ); |
208 | 0 | append( sb, "The property telling which phase to call on the generated archetype. Interesting values are: package, integration-test, install and deploy.", 3 ); |
209 | 0 | append( sb, "Expression: ${archetype.postPhase}", 3 ); |
210 | 0 | append( sb, "", 0 ); |
211 | |
|
212 | 0 | append( sb, "archetypeRegistryFile", 2 ); |
213 | 0 | append( sb, "The location of the registry file.", 3 ); |
214 | 0 | append( sb, "Expression: ${user.home}/.m2/archetype.xml", 3 ); |
215 | 0 | append( sb, "", 0 ); |
216 | |
|
217 | 0 | append( sb, "defaultEncoding (Default: UTF-8)", 2 ); |
218 | 0 | append( sb, "Velocity templates encoding.", 3 ); |
219 | 0 | append( sb, "Expression: ${archetype.encoding}", 3 ); |
220 | 0 | append( sb, "", 0 ); |
221 | |
|
222 | 0 | append( sb, "interactive (Default: false)", 2 ); |
223 | 0 | append( sb, "Enable the interactive mode to define the archetype from the project.", 3 ); |
224 | 0 | append( sb, "Expression: ${interactive}", 3 ); |
225 | 0 | append( sb, "", 0 ); |
226 | |
|
227 | 0 | append( sb, "keepParent", 2 ); |
228 | 0 | append( sb, "POMs in archetype are created with their initial parent. This property is ignored when preserveCData is true.", 3 ); |
229 | 0 | append( sb, "Expression: ${archetype.keepParent}", 3 ); |
230 | 0 | append( sb, "", 0 ); |
231 | |
|
232 | 0 | append( sb, "outputDirectory", 2 ); |
233 | 0 | append( sb, "The directory where the archetype should be created.", 3 ); |
234 | 0 | append( sb, "Expression: ${project.build.directory}/generated-sources/archetype", 3 ); |
235 | 0 | append( sb, "", 0 ); |
236 | |
|
237 | 0 | append( sb, "packageName", 2 ); |
238 | 0 | append( sb, "The package name for Java source files to be incorporated in the archetype and and relocated to the package that the user selects.", 3 ); |
239 | 0 | append( sb, "Expression: ${packageName}", 3 ); |
240 | 0 | append( sb, "", 0 ); |
241 | |
|
242 | 0 | append( sb, "partialArchetype", 2 ); |
243 | 0 | append( sb, "Create a partial archetype.", 3 ); |
244 | 0 | append( sb, "Expression: ${archetype.partialArchetype}", 3 ); |
245 | 0 | append( sb, "", 0 ); |
246 | |
|
247 | 0 | append( sb, "preserveCData", 2 ); |
248 | 0 | append( sb, "Create pom\'s velocity templates with CDATA preservation. This uses the String.replaceAll() method and risks to have some overly replacement capabilities (beware of \'1.0\' value).", 3 ); |
249 | 0 | append( sb, "Expression: ${archetype.preserveCData}", 3 ); |
250 | 0 | append( sb, "", 0 ); |
251 | |
|
252 | 0 | append( sb, "propertyFile", 2 ); |
253 | 0 | append( sb, "The property file that holds the plugin configuration. If this is provided, then the plugin reads properties from here. The properties in here can be standard properties listed below or custom properties for this archetype. The standard properties are below. Several of them overlap parameters of this goal; it\'s better to just set the parameter.\npackage\n\tSee the packageName parameter.\narchetype.languages\n\tSee the archetypeLanguages parameter.\ngroupId\n\tThe default groupId of the generated project.\nartifactId\n\tThe default artifactId of the generated project.\nversion\n\tThe default version of the generated project.\narchetype.filteredExtensions\n\tSee the filteredExensions parameter.\nCustom Properties\nCustom properties allow you to replace some constant values in the project\'s files with Velocity macro references. When a user generates a project from your archetype he or she gets the opportunity to replace the value from the source project.\n\nCustom property names may not contain the \'.\' character.\n\nFor example, if you include a line like the following in your property file:\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0cxf-version=2.5.1-SNAPSHOT\nthe plugin will search your files for the string\n2.5.1-SNAPSHOT\nand replace them with references to a velocity macro\ncxf-version\n. It will then list\ncxf-version\nas a\nrequiredProperty\nin the archetype-metadata.xml, with\n2.5.1-SNAPSHOT\nas the default value.\n\n", 3 ); |
254 | 0 | append( sb, "Expression: ${archetype.properties}", 3 ); |
255 | 0 | append( sb, "", 0 ); |
256 | |
|
257 | 0 | append( sb, "testMode", 2 ); |
258 | 0 | append( sb, "(no description available)", 3 ); |
259 | 0 | append( sb, "Expression: ${testMode}", 3 ); |
260 | 0 | append( sb, "", 0 ); |
261 | |
} |
262 | |
} |
263 | |
|
264 | 0 | if ( goal == null || goal.length() <= 0 || "generate".equals( goal ) ) |
265 | |
{ |
266 | 0 | append( sb, "archetype:generate", 0 ); |
267 | 0 | append( sb, "Generates a new project from an archetype, or updated the actual project if using a partial archetype. If the project is fully generated, it is generated in a directory corresponding to its artifactId. If the project is updated with a partial archetype, it is done in the current directory.", 1 ); |
268 | 0 | append( sb, "", 0 ); |
269 | 0 | if ( detail ) |
270 | |
{ |
271 | 0 | append( sb, "Available parameters:", 1 ); |
272 | 0 | append( sb, "", 0 ); |
273 | |
|
274 | 0 | append( sb, "archetypeArtifactId", 2 ); |
275 | 0 | append( sb, "The archetype\'s artifactId.", 3 ); |
276 | 0 | append( sb, "Expression: ${archetypeArtifactId}", 3 ); |
277 | 0 | append( sb, "", 0 ); |
278 | |
|
279 | 0 | append( sb, "archetypeCatalog (Default: remote,local)", 2 ); |
280 | 0 | append( sb, "The archetype catalogs to use to build a list and let the user choose from. It is a comma separated list of catalogs. Catalogs use following schemes:\n-\t\'file://...\' with archetype-catalog.xml automatically appended when pointing to a directory\n-\t\'http://...\' or \'https://...\' with archetype-catalog.xml always appended\n-\t\'local\' which is the shortcut for \'file://~/.m2/archetype-catalog.xml\'\n-\t\'remote\' which is the shortcut for Maven Central repository, ie \'http://repo1.maven.org/maven2\'\n-\t\'internal\' which is an internal catalog\nSince 2.0-alpha-5, default value is no longer internal,local but remote,local. If Maven Central repository catalog file is empty, internal catalog is used instead.", 3 ); |
281 | 0 | append( sb, "Expression: ${archetypeCatalog}", 3 ); |
282 | 0 | append( sb, "", 0 ); |
283 | |
|
284 | 0 | append( sb, "archetypeGroupId", 2 ); |
285 | 0 | append( sb, "The archetype\'s groupId.", 3 ); |
286 | 0 | append( sb, "Expression: ${archetypeGroupId}", 3 ); |
287 | 0 | append( sb, "", 0 ); |
288 | |
|
289 | 0 | append( sb, "archetypeRepository", 2 ); |
290 | 0 | append( sb, "The archetype\'s repository.", 3 ); |
291 | 0 | append( sb, "Expression: ${archetypeRepository}", 3 ); |
292 | 0 | append( sb, "", 0 ); |
293 | |
|
294 | 0 | append( sb, "archetypeVersion", 2 ); |
295 | 0 | append( sb, "The archetype\'s version.", 3 ); |
296 | 0 | append( sb, "Expression: ${archetypeVersion}", 3 ); |
297 | 0 | append( sb, "", 0 ); |
298 | |
|
299 | 0 | append( sb, "basedir", 2 ); |
300 | 0 | append( sb, "(no description available)", 3 ); |
301 | 0 | append( sb, "Expression: ${basedir}", 3 ); |
302 | 0 | append( sb, "", 0 ); |
303 | |
|
304 | 0 | append( sb, "filter", 2 ); |
305 | 0 | append( sb, "Applying some filter on displayed archetypes list: format is artifactId or groupId:artifactId.\n-\torg.apache: -> displays all archetypes which contain org.apache in groupId\n-\t:jee or jee -> displays all archetypes which contain jee in artifactId\n-\torg.apache:jee -> displays all archetypes which contain org.apache in groupId AND jee in artifactId\n", 3 ); |
306 | 0 | append( sb, "Expression: ${filter}", 3 ); |
307 | 0 | append( sb, "", 0 ); |
308 | |
|
309 | 0 | append( sb, "goals", 2 ); |
310 | 0 | append( sb, "Additional goals to immediately run on the project created from the archetype.", 3 ); |
311 | 0 | append( sb, "Expression: ${goals}", 3 ); |
312 | 0 | append( sb, "", 0 ); |
313 | |
|
314 | 0 | append( sb, "interactiveMode (Default: ${settings.interactiveMode})", 2 ); |
315 | 0 | append( sb, "User settings use to check the interactiveMode.", 3 ); |
316 | 0 | append( sb, "Required: Yes", 3 ); |
317 | 0 | append( sb, "Expression: ${interactiveMode}", 3 ); |
318 | 0 | append( sb, "", 0 ); |
319 | |
} |
320 | |
} |
321 | |
|
322 | 0 | if ( goal == null || goal.length() <= 0 || "help".equals( goal ) ) |
323 | |
{ |
324 | 0 | append( sb, "archetype:help", 0 ); |
325 | 0 | append( sb, "Display help information on maven-archetype-plugin.\nCall\n\u00a0\u00a0mvn\u00a0archetype:help\u00a0-Ddetail=true\u00a0-Dgoal=<goal-name>\nto display parameter details.", 1 ); |
326 | 0 | append( sb, "", 0 ); |
327 | 0 | if ( detail ) |
328 | |
{ |
329 | 0 | append( sb, "Available parameters:", 1 ); |
330 | 0 | append( sb, "", 0 ); |
331 | |
|
332 | 0 | append( sb, "detail (Default: false)", 2 ); |
333 | 0 | append( sb, "If true, display all settable properties for each goal.", 3 ); |
334 | 0 | append( sb, "Expression: ${detail}", 3 ); |
335 | 0 | append( sb, "", 0 ); |
336 | |
|
337 | 0 | append( sb, "goal", 2 ); |
338 | 0 | append( sb, "The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 ); |
339 | 0 | append( sb, "Expression: ${goal}", 3 ); |
340 | 0 | append( sb, "", 0 ); |
341 | |
|
342 | 0 | append( sb, "indentSize (Default: 2)", 2 ); |
343 | 0 | append( sb, "The number of spaces per indentation level, should be positive.", 3 ); |
344 | 0 | append( sb, "Expression: ${indentSize}", 3 ); |
345 | 0 | append( sb, "", 0 ); |
346 | |
|
347 | 0 | append( sb, "lineLength (Default: 80)", 2 ); |
348 | 0 | append( sb, "The maximum length of a display line, should be positive.", 3 ); |
349 | 0 | append( sb, "Expression: ${lineLength}", 3 ); |
350 | 0 | append( sb, "", 0 ); |
351 | |
} |
352 | |
} |
353 | |
|
354 | 0 | if ( goal == null || goal.length() <= 0 || "integration-test".equals( goal ) ) |
355 | |
{ |
356 | 0 | append( sb, "archetype:integration-test", 0 ); |
357 | 0 | append( sb, "Execute the archetype integration tests, consisting in generating projects from the current archetype and optionally comparing generated projects with reference copy.\n\nEach IT consists of a sub-directory in src/test/resources/projects containing:\n\n-\ta goal.txt file, containing a list of goals to run against the generated project (can be empty, content ignored before maven-archetype-plugin 2.1),\n-\tan archetype.properties file, containing properties for project generation,\n-\tan optional reference/ directory containing a reference copy of the expected project created from the IT.\nNotice that it is expected to be run as part as of a build after the package phase and not directly as a goal from CLI.", 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, "debug (Default: false)", 2 ); |
365 | 0 | append( sb, "Whether to show debug statements in the build output.", 3 ); |
366 | 0 | append( sb, "Expression: ${archetype.test.debug}", 3 ); |
367 | 0 | append( sb, "", 0 ); |
368 | |
|
369 | 0 | append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 ); |
370 | 0 | append( sb, "The file encoding for the post-build script.", 3 ); |
371 | 0 | append( sb, "Expression: ${encoding}", 3 ); |
372 | 0 | append( sb, "", 0 ); |
373 | |
|
374 | 0 | append( sb, "filterProperties", 2 ); |
375 | 0 | append( sb, "A list of additional properties which will be used to filter tokens in settings.xml", 3 ); |
376 | 0 | append( sb, "", 0 ); |
377 | |
|
378 | 0 | append( sb, "noLog (Default: false)", 2 ); |
379 | 0 | append( sb, "Suppress logging to the build.log file.", 3 ); |
380 | 0 | append( sb, "Expression: ${archetype.test.noLog}", 3 ); |
381 | 0 | append( sb, "", 0 ); |
382 | |
|
383 | 0 | append( sb, "postBuildHookScript (Default: verify)", 2 ); |
384 | 0 | append( sb, "Relative path of a cleanup/verification hook script to run after executing the build. This script may be written with either BeanShell or Groovy. If the file extension is omitted (e.g. verify), the plugin searches for the file by trying out the well-known extensions .bsh and .groovy. If this script exists for a particular project but returns any non-null value different from true or throws an exception, the corresponding build is flagged as a failure.", 3 ); |
385 | 0 | append( sb, "Expression: ${archetype.test.verifyScript}", 3 ); |
386 | 0 | append( sb, "", 0 ); |
387 | |
|
388 | 0 | append( sb, "settingsFile", 2 ); |
389 | 0 | append( sb, "Path to an alternate settings.xml to use for Maven invocation with all ITs. Note that the <localRepository> element of this settings file is always ignored, i.e. the path given by the parameter localRepositoryPath is dominant.", 3 ); |
390 | 0 | append( sb, "Expression: ${archetype.test.settingsFile}", 3 ); |
391 | 0 | append( sb, "", 0 ); |
392 | |
|
393 | 0 | append( sb, "showVersion (Default: false)", 2 ); |
394 | 0 | append( sb, "flag to enable show mvn version used for running its (cli option : -V,--show-version )", 3 ); |
395 | 0 | append( sb, "Expression: ${archetype.test.showVersion}", 3 ); |
396 | 0 | append( sb, "", 0 ); |
397 | |
|
398 | 0 | append( sb, "streamLogs (Default: true)", 2 ); |
399 | 0 | append( sb, "Flag used to determine whether the build logs should be output to the normal mojo log.", 3 ); |
400 | 0 | append( sb, "Expression: ${archetype.test.streamLogs}", 3 ); |
401 | 0 | append( sb, "", 0 ); |
402 | |
|
403 | 0 | append( sb, "testProjectsDirectory (Default: ${project.build.testOutputDirectory}/projects)", 2 ); |
404 | 0 | append( sb, "Directory of test projects", 3 ); |
405 | 0 | append( sb, "Required: Yes", 3 ); |
406 | 0 | append( sb, "Expression: ${archetype.test.projectsDirectory}", 3 ); |
407 | 0 | append( sb, "", 0 ); |
408 | |
} |
409 | |
} |
410 | |
|
411 | 0 | if ( goal == null || goal.length() <= 0 || "jar".equals( goal ) ) |
412 | |
{ |
413 | 0 | append( sb, "archetype:jar", 0 ); |
414 | 0 | append( sb, "Build a JAR from the current Archetype project.", 1 ); |
415 | 0 | append( sb, "", 0 ); |
416 | 0 | if ( detail ) |
417 | |
{ |
418 | 0 | append( sb, "Available parameters:", 1 ); |
419 | 0 | append( sb, "", 0 ); |
420 | |
|
421 | 0 | append( sb, "archetypeDirectory", 2 ); |
422 | 0 | append( sb, "Directory containing the classes.", 3 ); |
423 | 0 | append( sb, "Required: Yes", 3 ); |
424 | 0 | append( sb, "Expression: ${project.build.outputDirectory}", 3 ); |
425 | 0 | append( sb, "", 0 ); |
426 | |
|
427 | 0 | append( sb, "finalName", 2 ); |
428 | 0 | append( sb, "Name of the generated JAR.", 3 ); |
429 | 0 | append( sb, "Required: Yes", 3 ); |
430 | 0 | append( sb, "Expression: ${project.build.finalName}", 3 ); |
431 | 0 | append( sb, "", 0 ); |
432 | |
|
433 | 0 | append( sb, "outputDirectory", 2 ); |
434 | 0 | append( sb, "Directory containing the generated JAR.", 3 ); |
435 | 0 | append( sb, "Required: Yes", 3 ); |
436 | 0 | append( sb, "Expression: ${project.build.directory}", 3 ); |
437 | 0 | append( sb, "", 0 ); |
438 | |
} |
439 | |
} |
440 | |
|
441 | 0 | if ( goal == null || goal.length() <= 0 || "update-local-catalog".equals( goal ) ) |
442 | |
{ |
443 | 0 | append( sb, "archetype:update-local-catalog", 0 ); |
444 | 0 | append( sb, "Updates the local catalog", 1 ); |
445 | 0 | append( sb, "", 0 ); |
446 | 0 | if ( detail ) |
447 | |
{ |
448 | 0 | append( sb, "Available parameters:", 1 ); |
449 | 0 | append( sb, "", 0 ); |
450 | |
} |
451 | |
} |
452 | |
|
453 | 0 | if ( getLog().isInfoEnabled() ) |
454 | |
{ |
455 | 0 | getLog().info( sb.toString() ); |
456 | |
} |
457 | 0 | } |
458 | |
|
459 | |
|
460 | |
|
461 | |
|
462 | |
|
463 | |
|
464 | |
|
465 | |
|
466 | |
|
467 | |
|
468 | |
private static String repeat( String str, int repeat ) |
469 | |
{ |
470 | 0 | StringBuffer buffer = new StringBuffer( repeat * str.length() ); |
471 | |
|
472 | 0 | for ( int i = 0; i < repeat; i++ ) |
473 | |
{ |
474 | 0 | buffer.append( str ); |
475 | |
} |
476 | |
|
477 | 0 | return buffer.toString(); |
478 | |
} |
479 | |
|
480 | |
|
481 | |
|
482 | |
|
483 | |
|
484 | |
|
485 | |
|
486 | |
|
487 | |
|
488 | |
private void append( StringBuffer sb, String description, int indent ) |
489 | |
{ |
490 | 0 | for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); ) |
491 | |
{ |
492 | 0 | sb.append( it.next().toString() ).append( '\n' ); |
493 | |
} |
494 | 0 | } |
495 | |
|
496 | |
|
497 | |
|
498 | |
|
499 | |
|
500 | |
|
501 | |
|
502 | |
|
503 | |
|
504 | |
|
505 | |
|
506 | |
private static List toLines( String text, int indent, int indentSize, int lineLength ) |
507 | |
{ |
508 | 0 | List<String> lines = new ArrayList<String>(); |
509 | |
|
510 | 0 | String ind = repeat( "\t", indent ); |
511 | 0 | String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" ); |
512 | 0 | for ( int i = 0; i < plainLines.length; i++ ) |
513 | |
{ |
514 | 0 | toLines( lines, ind + plainLines[i], indentSize, lineLength ); |
515 | |
} |
516 | |
|
517 | 0 | return lines; |
518 | |
} |
519 | |
|
520 | |
|
521 | |
|
522 | |
|
523 | |
|
524 | |
|
525 | |
|
526 | |
|
527 | |
|
528 | |
private static void toLines( List<String> lines, String line, int indentSize, int lineLength ) |
529 | |
{ |
530 | 0 | int lineIndent = getIndentLevel( line ); |
531 | 0 | StringBuffer buf = new StringBuffer( 256 ); |
532 | 0 | String[] tokens = line.split( " +" ); |
533 | 0 | for ( int i = 0; i < tokens.length; i++ ) |
534 | |
{ |
535 | 0 | String token = tokens[i]; |
536 | 0 | if ( i > 0 ) |
537 | |
{ |
538 | 0 | if ( buf.length() + token.length() >= lineLength ) |
539 | |
{ |
540 | 0 | lines.add( buf.toString() ); |
541 | 0 | buf.setLength( 0 ); |
542 | 0 | buf.append( repeat( " ", lineIndent * indentSize ) ); |
543 | |
} |
544 | |
else |
545 | |
{ |
546 | 0 | buf.append( ' ' ); |
547 | |
} |
548 | |
} |
549 | 0 | for ( int j = 0; j < token.length(); j++ ) |
550 | |
{ |
551 | 0 | char c = token.charAt( j ); |
552 | 0 | if ( c == '\t' ) |
553 | |
{ |
554 | 0 | buf.append( repeat( " ", indentSize - buf.length() % indentSize ) ); |
555 | |
} |
556 | 0 | else if ( c == '\u00A0' ) |
557 | |
{ |
558 | 0 | buf.append( ' ' ); |
559 | |
} |
560 | |
else |
561 | |
{ |
562 | 0 | buf.append( c ); |
563 | |
} |
564 | |
} |
565 | |
} |
566 | 0 | lines.add( buf.toString() ); |
567 | 0 | } |
568 | |
|
569 | |
|
570 | |
|
571 | |
|
572 | |
|
573 | |
|
574 | |
|
575 | |
private static int getIndentLevel( String line ) |
576 | |
{ |
577 | 0 | int level = 0; |
578 | 0 | for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ ) |
579 | |
{ |
580 | 0 | level++; |
581 | |
} |
582 | 0 | for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ ) |
583 | |
{ |
584 | 0 | if ( line.charAt( i ) == '\t' ) |
585 | |
{ |
586 | 0 | level++; |
587 | 0 | break; |
588 | |
} |
589 | |
} |
590 | 0 | return level; |
591 | |
} |
592 | |
} |