1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 package org.apache.rat.plugin;
21
22 import org.apache.commons.cli.Option;
23 import org.apache.commons.lang3.StringUtils;
24 import org.apache.maven.plugin.AbstractMojo;
25 import org.apache.maven.plugins.annotations.Parameter;
26 import org.apache.rat.commandline.Arg;
27 import org.apache.rat.DeprecationReporter;
28 import org.apache.rat.utils.CasedString;
29 import org.apache.rat.utils.DefaultLog;
30 import org.apache.rat.utils.Log;
31
32 import java.util.ArrayList;
33 import java.util.Arrays;
34 import java.util.Collections;
35 import java.util.HashMap;
36 import java.util.List;
37 import java.util.Map;
38 import java.util.Objects;
39
40 /**
41 * Generated class to provide Maven support for standard RAT command line options
42 * DO NOT EDIT - GENERATED FILE
43 */
44 public abstract class BaseRatMojo extends AbstractMojo {
45
46 private static final Map<String, String> xlateName = new HashMap<>();
47
48 private static final List<String> unsupportedArgs = new ArrayList<>();
49
50 private static final Map<String, String> deprecatedArgs = new HashMap<>();
51
52 static {
53 xlateName.put("addLicense", "add-license");
54 unsupportedArgs.add("a");
55 unsupportedArgs.add("dir");
56 unsupportedArgs.add("log-level");
57 deprecatedArgs.put("force", "Use of deprecated option 'force'. Deprecated for removal since 0.17: Use <editOverwrite> instead.");
58 deprecatedArgs.put("list-families", "Use of deprecated option 'listFamilies'. Deprecated for removal since 0.17: Use <outputFamilies> instead.");
59 deprecatedArgs.put("list-licenses", "Use of deprecated option 'listLicenses'. Deprecated for removal since 0.17: Use <outputLicenses> instead.");
60 deprecatedArgs.put("licenses", "Use of deprecated option 'licenses'. Deprecated for removal since 0.17: Use <config> instead.");
61 deprecatedArgs.put("copyright", "Use of deprecated option 'copyright'. Deprecated for removal since 0.17: Use <editCopyright> instead.");
62 deprecatedArgs.put("exclude", "Use of deprecated option 'exclude'. Deprecated for removal since 0.17: Use <inputExclude> instead.");
63 deprecatedArgs.put("out", "Use of deprecated option 'out'. Deprecated for removal since 0.17: Use <outputFile> instead.");
64 deprecatedArgs.put("includes-file", "Use of deprecated option 'includesFile'. Deprecated for removal since 0.17: Use <inputIncludeFile> instead.");
65 deprecatedArgs.put("exclude-file", "Use of deprecated option 'excludeFile'. Deprecated for removal since 0.17: Use <inputExcludeFile> instead.");
66 deprecatedArgs.put("addLicense", "Use of deprecated option 'addLicense'. Deprecated for removal since 0.17: Use <editLicense> instead.");
67 deprecatedArgs.put("stylesheet", "Use of deprecated option 'stylesheet'. Deprecated for removal since 0.17: Use <outputStyle> instead.");
68 deprecatedArgs.put("include", "Use of deprecated option 'include'. Deprecated for removal since 0.17: Use <inputInclude> instead.");
69 deprecatedArgs.put("scan-hidden-directories", "Use of deprecated option 'scanHiddenDirectories'. Deprecated for removal since 0.17: Use <inputIncludeStd> with 'HIDDEN_DIR' argument instead.");
70 deprecatedArgs.put("xml", "Use of deprecated option 'xml'. Deprecated for removal since 0.17: Use <outputStyle> with the 'xml' argument instead.");
71 deprecatedArgs.put("no-default-licenses", "Use of deprecated option 'noDefaultLicenses'. Deprecated for removal since 0.17: Use <configurationNoDefaults> instead.");
72 }
73
74 /**
75 * Creates a Maven name from a long option.
76 * Will map excluded long options to null.
77 * @param longOpt the kebab name.
78 * @return The CamelCased name for Maven use.
79 */
80 public static String createName(String longOpt) {
81 String name = xlateName.get(longOpt);
82 return name != null ? name : new CasedString(CasedString.StringCase.KEBAB, longOpt).toCase(CasedString.StringCase.PASCAL);
83 }
84
85 /**
86 * Creates a kebab case name from a camel case name.
87 * @param camelCase the camel case name to convert.
88 * @return the kebab format.
89 */
90 public static String toKebabForm(String camelCase) {
91 return new CasedString(CasedString.StringCase.CAMEL, camelCase).toCase(CasedString.StringCase.KEBAB);
92 }
93
94 /**
95 * Returns the list of unsupported args.
96 * @return the list of kebab style names that are unsupported by the Maven UI.
97 */
98 public static List<String> unsupportedArgs() {
99 return Collections.unmodifiableList(unsupportedArgs);
100 }
101
102 ///////////////////////// Start common Arg manipulation code
103
104 /**
105 * Sets the deprecation report method.
106 */
107 private static void setDeprecationReporter() {
108 DeprecationReporter.setLogReporter(opt -> {
109 String msg = deprecatedArgs.get(argsKey(opt));
110 if (msg == null) {
111 DeprecationReporter.getDefault().accept(opt);
112 } else {
113 DefaultLog.getInstance().warn(msg);
114 }
115 });
116 }
117
118 private static String argsKey(Option opt) {
119 return StringUtils.defaultIfEmpty(opt.getLongOpt(), opt.getKey());
120 }
121
122 /**
123 * A map of CLI-based arguments to values.
124 */
125 protected final Map<String, List<String>> args = new HashMap<>();
126
127 /**
128 * Gets the list of arguments prepared for the CLI code to parse.
129 * @return the List of arguments for the CLI command line.
130 */
131 protected List<String> args() {
132 List<String> result = new ArrayList<>();
133 for (Map.Entry<String, List<String>> entry : args.entrySet()) {
134 result.add("--" + entry.getKey());
135 result.addAll(entry.getValue().stream().filter(Objects::nonNull).toList());
136 }
137 return result;
138 }
139
140 private boolean validateSet(String key) {
141 Arg arg = Arg.findArg(key);
142 if (arg != null) {
143 Option opt = arg.find(key);
144 Option main = arg.option();
145 if (opt.isDeprecated()) {
146 args.remove(argsKey(main));
147 // deprecated options must be explicitly set so let it go.
148 return true;
149 }
150 // non-deprecated options may have default so ignore it if another option has already been set.
151 for (Option o : arg.group().getOptions()) {
152 if (!o.equals(main)) {
153 if (args.containsKey(argsKey(o))) {
154 return false;
155 }
156 }
157 }
158 return true;
159 }
160 return false;
161 }
162
163 /**
164 * Set a key and value into the argument list.
165 * Replaces any existing value.
166 * @param key the key for the map.
167 * @param value the value to set.
168 */
169 protected void setArg(String key, String value) {
170 if (value == null || StringUtils.isNotBlank(value)) {
171 if (validateSet(key)) {
172 List<String> values = new ArrayList<>();
173 if (DefaultLog.getInstance().isEnabled(Log.Level.DEBUG)) {
174 DefaultLog.getInstance().debug(String.format("Setting %s to '%s'", key, value));
175 }
176 values.add(value);
177 args.put(key, values);
178 }
179 }
180 }
181
182 /**
183 * Get the list of values for a key.
184 * @param key the key for the map.
185 * @return the list of values for the key or {@code null} if not set.
186 */
187 public List<String> getArg(String key) {
188 return args.get(key);
189 }
190
191 /**
192 * Add values to the key in the argument list.
193 * empty values are ignored. If no non-empty values are present no change is made.
194 * If the key does not exist, adds it.
195 * @param key the key for the map.
196 * @param value the array of values to set.
197 */
198 protected void addArg(String key, String[] value) {
199 List<String> newValues = Arrays.stream(value).filter(StringUtils::isNotBlank).toList();
200 if (!newValues.isEmpty()) {
201 if (validateSet(key)) {
202 if (DefaultLog.getInstance().isEnabled(Log.Level.DEBUG)) {
203 DefaultLog.getInstance().debug(String.format("Adding [%s] to %s", String.join(", ", Arrays.asList(value)), key));
204 }
205 List<String> values = args.computeIfAbsent(key, k -> new ArrayList<>());
206 values.addAll(newValues);
207 }
208 }
209 }
210
211 /**
212 * Add a value to the key in the argument list.
213 * If the key does not exist, adds it.
214 * @param key the key for the map.
215 * @param value the value to set.
216 */
217 protected void addArg(String key, String value) {
218 if (StringUtils.isNotBlank(value)) {
219 if (validateSet(key)) {
220 List<String> values = args.get(key);
221 if (DefaultLog.getInstance().isEnabled(Log.Level.DEBUG)) {
222 DefaultLog.getInstance().debug(String.format("Adding [%s] to %s", String.join(", ", Arrays.asList(value)), key));
223 }
224 if (values == null) {
225 values = new ArrayList<>();
226 args.put(key, values);
227 }
228 values.add(value);
229 }
230 }
231 }
232
233 /**
234 * Remove a key from the argument list.
235 * @param key the key to remove from the map.
236 */
237 protected void removeArg(String key) {
238 args.remove(key);
239 }
240
241 ///////////////////////// End common Arg manipulation code
242
243 protected BaseRatMojo() {
244 setDeprecationReporter();
245 }
246
247 /* GENERATED METHODS */
248
249
250 /**
251 * Reads <Expression> entries from a file. Entries will override excluded files. Argument should be a File. (See Argument Types for clarification)
252 * @param inputIncludeFile <Expression> entries from a file.
253 */
254 @Parameter(property = "rat.InputIncludeFile")
255 public void setInputIncludeFile(String inputIncludeFile) {
256 setArg("input-include-file", inputIncludeFile);
257 }
258 /**
259 * Forces any changes in files to be written directly to the source files so that new files are not created.
260 * @param force The state
261 * @deprecated Deprecated for removal since 0.17: Use <editOverwrite> instead.
262 */
263 @Deprecated
264 @Parameter(property = "rat.Force")
265 public void setForce(boolean force) {
266 if (force) {
267 setArg("force", null);
268 } else {
269 removeArg("force");
270 }
271 }
272 /**
273 * List the defined license families. Argument should be a LicenseFilter. (See Argument Types for clarification)
274 * @param listFamilies The defined license families.
275 * @deprecated Deprecated for removal since 0.17: Use <outputFamilies> instead.
276 */
277 @Deprecated
278 @Parameter(property = "rat.ListFamilies")
279 public void setListFamilies(String listFamilies) {
280 setArg("list-families", listFamilies);
281 }
282 /**
283 * A file containing file names to process. File names must use linux directory separator ('/') or none at all. File names that do not start with '/' are relative to the directory where the argument is located. Arguments should be File. (See Argument Types for clarification)
284 * @param inputSource File containing file names to process.
285 */
286 @Parameter
287 public void setInputSources(String[] inputSource) {
288 addArg("input-source", inputSource);
289 }
290 /**
291 * A file containing file names to process. File names must use linux directory separator ('/') or none at all. File names that do not start with '/' are relative to the directory where the argument is located. Arguments should be File. (See Argument Types for clarification)
292 * @param inputSource File containing file names to process.
293 */
294 @Parameter
295 public void setInputSource(String inputSource) {
296 addArg("input-source", inputSource);
297 }
298 /**
299 * List the defined licenses. Argument should be a LicenseFilter. (See Argument Types for clarification)
300 * @param listLicenses The defined licenses.
301 * @deprecated Deprecated for removal since 0.17: Use <outputLicenses> instead.
302 */
303 @Deprecated
304 @Parameter(property = "rat.ListLicenses")
305 public void setListLicenses(String listLicenses) {
306 setArg("list-licenses", listLicenses);
307 }
308 /**
309 * The minimum number for the specified counter. Arguments should be CounterPattern. (See Argument Types for clarification)
310 * @param counterMin Minimum number for the specified counter.
311 */
312 @Parameter
313 public void setCounterMins(String[] counterMin) {
314 addArg("counter-min", counterMin);
315 }
316 /**
317 * The minimum number for the specified counter. Arguments should be CounterPattern. (See Argument Types for clarification)
318 * @param counterMin Minimum number for the specified counter.
319 */
320 @Parameter
321 public void setCounterMin(String counterMin) {
322 addArg("counter-min", counterMin);
323 }
324 /**
325 * Reads <Expression> entries from a file. Entries will be excluded from processing. Argument should be a File. (See Argument Types for clarification)
326 * @param inputExcludeFile <Expression> entries from a file.
327 */
328 @Parameter(property = "rat.InputExcludeFile")
329 public void setInputExcludeFile(String inputExcludeFile) {
330 setArg("input-exclude-file", inputExcludeFile);
331 }
332 /**
333 * Includes files matching <Expression>. Will override excluded files. Arguments should be Expression. (See Argument Types for clarification)
334 * @param inputInclude Files matching <Expression>.
335 */
336 @Parameter
337 public void setInputIncludes(String[] inputInclude) {
338 addArg("input-include", inputInclude);
339 }
340 /**
341 * Includes files matching <Expression>. Will override excluded files. Arguments should be Expression. (See Argument Types for clarification)
342 * @param inputInclude Files matching <Expression>.
343 */
344 @Parameter
345 public void setInputInclude(String inputInclude) {
346 addArg("input-include", inputInclude);
347 }
348 /**
349 * File names for system configuration. Arguments should be File. (See Argument Types for clarification)
350 * @param config Names for system configuration.
351 */
352 @Parameter
353 public void setConfigs(String[] config) {
354 addArg("config", config);
355 }
356 /**
357 * File names for system configuration. Arguments should be File. (See Argument Types for clarification)
358 * @param config Names for system configuration.
359 */
360 @Parameter
361 public void setConfig(String config) {
362 addArg("config", config);
363 }
364 /**
365 * File names for system configuration. Arguments should be File. (See Argument Types for clarification)
366 * @param licenses Names for system configuration.
367 * @deprecated Deprecated for removal since 0.17: Use <config> instead.
368 */
369 @Deprecated
370 @Parameter
371 public void setLicenses(String[] licenses) {
372 addArg("licenses", licenses);
373 }
374 /**
375 * File names for system configuration. Arguments should be File. (See Argument Types for clarification)
376 * @param licenses Names for system configuration.
377 * @deprecated Deprecated for removal since 0.17: Use <config> instead.
378 */
379 @Deprecated
380 @Parameter
381 public void setLicenses(String licenses) {
382 addArg("licenses", licenses);
383 }
384 /**
385 * List the defined licenses. Argument should be a LicenseFilter. (See Argument Types for clarification)
386 * @param outputLicenses The defined licenses.
387 */
388 @Parameter(property = "rat.OutputLicenses", defaultValue = "NONE")
389 public void setOutputLicenses(String outputLicenses) {
390 setArg("output-licenses", outputLicenses);
391 }
392 /**
393 * Add the Apache-2.0 license header to any file with an unknown license that is not in the exclusion list. By default new files will be created with the license header, to force the modification of existing files use the <editOverwrite> option.
394 * @param editLicense The state
395 */
396 @Parameter(property = "rat.EditLicense")
397 public void setEditLicense(boolean editLicense) {
398 if (editLicense) {
399 setArg("edit-license", null);
400 } else {
401 removeArg("edit-license");
402 }
403 }
404 /**
405 * Excludes files defined in standard collections based on commonly occurring groups. Excludes any path matcher actions but DOES NOT exclude any file processor actions. Arguments should be StandardCollection. (See Argument Types for clarification)
406 * @param inputExcludeStd Files defined in standard collections based on commonly occurring groups.
407 */
408 @Parameter
409 public void setInputExcludeStds(String[] inputExcludeStd) {
410 addArg("input-exclude-std", inputExcludeStd);
411 }
412 /**
413 * Excludes files defined in standard collections based on commonly occurring groups. Excludes any path matcher actions but DOES NOT exclude any file processor actions. Arguments should be StandardCollection. (See Argument Types for clarification)
414 * @param inputExcludeStd Files defined in standard collections based on commonly occurring groups.
415 */
416 @Parameter
417 public void setInputExcludeStd(String inputExcludeStd) {
418 addArg("input-exclude-std", inputExcludeStd);
419 }
420 /**
421 * Excludes files with sizes less than the number of bytes specified. Argument should be a Integer. (See Argument Types for clarification)
422 * @param inputExcludeSize Files with sizes less than the number of bytes specified.
423 */
424 @Parameter(property = "rat.InputExcludeSize")
425 public void setInputExcludeSize(String inputExcludeSize) {
426 setArg("input-exclude-size", inputExcludeSize);
427 }
428 /**
429 * The copyright message to use in the license headers. Argument should be a Arg. (See Argument Types for clarification)
430 * @param copyright Copyright message to use in the license headers.
431 * @deprecated Deprecated for removal since 0.17: Use <editCopyright> instead.
432 */
433 @Deprecated
434 @Parameter(property = "rat.Copyright")
435 public void setCopyright(String copyright) {
436 setArg("copyright", copyright);
437 }
438 /**
439 * Specifies the level of detail in ARCHIVE file reporting. Argument should be a ProcessingType. (See Argument Types for clarification)
440 * @param outputArchive The level of detail in ARCHIVE file reporting.
441 */
442 @Parameter(property = "rat.OutputArchive", defaultValue = "NOTIFICATION")
443 public void setOutputArchive(String outputArchive) {
444 setArg("output-archive", outputArchive);
445 }
446 /**
447 * Forces any changes in files to be written directly to the source files so that new files are not created. Only valid with <editLicense>.
448 * @param editOverwrite The state
449 */
450 @Parameter(property = "rat.EditOverwrite")
451 public void setEditOverwrite(boolean editOverwrite) {
452 if (editOverwrite) {
453 setArg("edit-overwrite", null);
454 } else {
455 removeArg("edit-overwrite");
456 }
457 }
458 /**
459 * Ignore default configuration.
460 * @param configurationNoDefaults The state
461 */
462 @Parameter(property = "rat.ConfigurationNoDefaults")
463 public void setConfigurationNoDefaults(boolean configurationNoDefaults) {
464 if (configurationNoDefaults) {
465 setArg("configuration-no-defaults", null);
466 } else {
467 removeArg("configuration-no-defaults");
468 }
469 }
470 /**
471 * Excludes files matching <Expression>. Arguments should be Expression. (See Argument Types for clarification)
472 * @param exclude Files matching <Expression>.
473 * @deprecated Deprecated for removal since 0.17: Use <inputExclude> instead.
474 */
475 @Deprecated
476 @Parameter
477 public void setExcludes(String[] exclude) {
478 addArg("exclude", exclude);
479 }
480 /**
481 * Excludes files matching <Expression>. Arguments should be Expression. (See Argument Types for clarification)
482 * @param exclude Files matching <Expression>.
483 * @deprecated Deprecated for removal since 0.17: Use <inputExclude> instead.
484 */
485 @Deprecated
486 @Parameter
487 public void setExclude(String exclude) {
488 addArg("exclude", exclude);
489 }
490 /**
491 * Define the output file where to write a report to. Argument should be a File. (See Argument Types for clarification)
492 * @param out The output file where to write a report to.
493 * @deprecated Deprecated for removal since 0.17: Use <outputFile> instead.
494 */
495 @Deprecated
496 @Parameter(property = "rat.Out")
497 public void setOut(String out) {
498 setArg("out", out);
499 }
500 /**
501 * A comma separated list of denied License family IDs. These license families will be removed from the list of approved licenses. Once license families are removed they can not be added back. Argument should be a FamilyID. (See Argument Types for clarification)
502 * @param licenseFamiliesDenied Comma separated list of denied License family IDs.
503 */
504 @Parameter(property = "rat.LicenseFamiliesDenied")
505 public void setLicenseFamiliesDenied(String licenseFamiliesDenied) {
506 setArg("license-families-denied", licenseFamiliesDenied);
507 }
508 /**
509 * Reads <Expression> entries from a file. Entries will override excluded files. Argument should be a File. (See Argument Types for clarification)
510 * @param includesFile <Expression> entries from a file.
511 * @deprecated Deprecated for removal since 0.17: Use <inputIncludeFile> instead.
512 */
513 @Deprecated
514 @Parameter(property = "rat.IncludesFile")
515 public void setIncludesFile(String includesFile) {
516 setArg("includes-file", includesFile);
517 }
518 /**
519 * Name of file containing comma separated lists of the denied license IDs. These licenses will be removed from the list of approved licenses. Once licenses are removed they can not be added back. Argument should be a File. (See Argument Types for clarification)
520 * @param licensesDeniedFile Of file containing comma separated lists of the denied license IDs.
521 */
522 @Parameter(property = "rat.LicensesDeniedFile")
523 public void setLicensesDeniedFile(String licensesDeniedFile) {
524 setArg("licenses-denied-file", licensesDeniedFile);
525 }
526 /**
527 * Reads <Expression> entries from a file. Entries will be excluded from processing. Argument should be a File. (See Argument Types for clarification)
528 * @param excludeFile <Expression> entries from a file.
529 * @deprecated Deprecated for removal since 0.17: Use <inputExcludeFile> instead.
530 */
531 @Deprecated
532 @Parameter(property = "rat.ExcludeFile")
533 public void setExcludeFile(String excludeFile) {
534 setArg("exclude-file", excludeFile);
535 }
536 /**
537 * Name of file containing comma separated lists of approved License IDs. Argument should be a File. (See Argument Types for clarification)
538 * @param licensesApprovedFile Of file containing comma separated lists of approved License IDs.
539 */
540 @Parameter(property = "rat.LicensesApprovedFile")
541 public void setLicensesApprovedFile(String licensesApprovedFile) {
542 setArg("licenses-approved-file", licensesApprovedFile);
543 }
544 /**
545 * Includes files defined in standard collections based on commonly occurring groups. Includes any path matcher actions but DOES NOT include any file processor actions. Arguments should be StandardCollection. (See Argument Types for clarification)
546 * @param inputIncludeStd Files defined in standard collections based on commonly occurring groups.
547 */
548 @Parameter
549 public void setInputIncludeStds(String[] inputIncludeStd) {
550 addArg("input-include-std", inputIncludeStd);
551 }
552 /**
553 * Includes files defined in standard collections based on commonly occurring groups. Includes any path matcher actions but DOES NOT include any file processor actions. Arguments should be StandardCollection. (See Argument Types for clarification)
554 * @param inputIncludeStd Files defined in standard collections based on commonly occurring groups.
555 */
556 @Parameter
557 public void setInputIncludeStd(String inputIncludeStd) {
558 addArg("input-include-std", inputIncludeStd);
559 }
560 /**
561 * XSLT stylesheet to use when creating the report. Either an external xsl file may be specified or one of the internal named sheets. Argument should be a StyleSheet. (See Argument Types for clarification)
562 * @param outputStyle Stylesheet to use when creating the report.
563 */
564 @Parameter(property = "rat.OutputStyle")
565 public void setOutputStyle(String outputStyle) {
566 setArg("output-style", outputStyle);
567 }
568 /**
569 * If set do not update the files but generate the reports.
570 * @param dryRun The state
571 */
572 @Parameter(property = "rat.DryRun")
573 public void setDryRun(boolean dryRun) {
574 if (dryRun) {
575 setArg("dry-run", null);
576 } else {
577 removeArg("dry-run");
578 }
579 }
580 /**
581 * Define the output file where to write a report to. Argument should be a File. (See Argument Types for clarification)
582 * @param outputFile The output file where to write a report to.
583 */
584 @Parameter(property = "rat.OutputFile")
585 public void setOutputFile(String outputFile) {
586 setArg("output-file", outputFile);
587 }
588 /**
589 * Specifies the level of detail in STANDARD file reporting. Argument should be a ProcessingType. (See Argument Types for clarification)
590 * @param outputStandard The level of detail in STANDARD file reporting.
591 */
592 @Parameter(property = "rat.OutputStandard", defaultValue = "ABSENCE")
593 public void setOutputStandard(String outputStandard) {
594 setArg("output-standard", outputStandard);
595 }
596 /**
597 * The acceptable maximum number for the specified counter. A value of '-1' specifies an unlimited number. Arguments should be CounterPattern. (See Argument Types for clarification)
598 * @param counterMax Acceptable maximum number for the specified counter.
599 */
600 @Parameter
601 public void setCounterMaxs(String[] counterMax) {
602 addArg("counter-max", counterMax);
603 }
604 /**
605 * The acceptable maximum number for the specified counter. A value of '-1' specifies an unlimited number. Arguments should be CounterPattern. (See Argument Types for clarification)
606 * @param counterMax Acceptable maximum number for the specified counter.
607 */
608 @Parameter
609 public void setCounterMax(String counterMax) {
610 addArg("counter-max", counterMax);
611 }
612 /**
613 * Excludes files matching <Expression>. Arguments should be Expression. (See Argument Types for clarification)
614 * @param inputExclude Files matching <Expression>.
615 */
616 @Parameter
617 public void setInputExcludes(String[] inputExclude) {
618 addArg("input-exclude", inputExclude);
619 }
620 /**
621 * Excludes files matching <Expression>. Arguments should be Expression. (See Argument Types for clarification)
622 * @param inputExclude Files matching <Expression>.
623 */
624 @Parameter
625 public void setInputExclude(String inputExclude) {
626 addArg("input-exclude", inputExclude);
627 }
628 /**
629 * A comma separated list of approved license family IDs. These license families will be added to the list of approved license families. Argument should be a FamilyID. (See Argument Types for clarification)
630 * @param licenseFamiliesApproved Comma separated list of approved license family IDs.
631 */
632 @Parameter(property = "rat.LicenseFamiliesApproved")
633 public void setLicenseFamiliesApproved(String licenseFamiliesApproved) {
634 setArg("license-families-approved", licenseFamiliesApproved);
635 }
636 /**
637 * Name of file containing comma separated lists of approved family IDs. Argument should be a File. (See Argument Types for clarification)
638 * @param licenseFamiliesApprovedFile Of file containing comma separated lists of approved family IDs.
639 */
640 @Parameter(property = "rat.LicenseFamiliesApprovedFile")
641 public void setLicenseFamiliesApprovedFile(String licenseFamiliesApprovedFile) {
642 setArg("license-families-approved-file", licenseFamiliesApprovedFile);
643 }
644 /**
645 * Add the Apache-2.0 license header to any file with an unknown license that is not in the exclusion list.
646 * @param addLicense The state
647 * @deprecated Deprecated for removal since 0.17: Use <editLicense> instead.
648 */
649 @Deprecated
650 @Parameter(property = "rat.AddLicense")
651 public void setAddLicense(boolean addLicense) {
652 if (addLicense) {
653 setArg("addLicense", null);
654 } else {
655 removeArg("addLicense");
656 }
657 }
658 /**
659 * A comma separated list of denied License IDs. These licenses will be removed from the list of approved licenses. Once licenses are removed they can not be added back. Argument should be a LicenseID. (See Argument Types for clarification)
660 * @param licensesDenied Comma separated list of denied License IDs.
661 */
662 @Parameter(property = "rat.LicensesDenied")
663 public void setLicensesDenied(String licensesDenied) {
664 setArg("licenses-denied", licensesDenied);
665 }
666 /**
667 * Parse SCM based exclusion files to exclude specified files and directories. This action can apply to any standard collection that implements a file processor. Arguments should be StandardCollection. (See Argument Types for clarification)
668 * @param inputExcludeParsedScm SCM based exclusion files to exclude specified files and directories.
669 */
670 @Parameter
671 public void setInputExcludeParsedScms(String[] inputExcludeParsedScm) {
672 addArg("input-exclude-parsed-scm", inputExcludeParsedScm);
673 }
674 /**
675 * Parse SCM based exclusion files to exclude specified files and directories. This action can apply to any standard collection that implements a file processor. Arguments should be StandardCollection. (See Argument Types for clarification)
676 * @param inputExcludeParsedScm SCM based exclusion files to exclude specified files and directories.
677 */
678 @Parameter
679 public void setInputExcludeParsedScm(String inputExcludeParsedScm) {
680 addArg("input-exclude-parsed-scm", inputExcludeParsedScm);
681 }
682 /**
683 * XSLT stylesheet to use when creating the report. Argument should be a StyleSheet. (See Argument Types for clarification)
684 * @param stylesheet Stylesheet to use when creating the report.
685 * @deprecated Deprecated for removal since 0.17: Use <outputStyle> instead.
686 */
687 @Deprecated
688 @Parameter(property = "rat.Stylesheet")
689 public void setStylesheet(String stylesheet) {
690 setArg("stylesheet", stylesheet);
691 }
692 /**
693 * The copyright message to use in the license headers. Usually in the form of "Copyright 2008 Foo". Only valid with <editLicense> Argument should be a Arg. (See Argument Types for clarification)
694 * @param editCopyright Copyright message to use in the license headers.
695 */
696 @Parameter(property = "rat.EditCopyright")
697 public void setEditCopyright(String editCopyright) {
698 setArg("edit-copyright", editCopyright);
699 }
700 /**
701 * A comma separated list of approved License IDs. These licenses will be added to the list of approved licenses. Argument should be a LicenseID. (See Argument Types for clarification)
702 * @param licensesApproved Comma separated list of approved License IDs.
703 */
704 @Parameter(property = "rat.LicensesApproved")
705 public void setLicensesApproved(String licensesApproved) {
706 setArg("licenses-approved", licensesApproved);
707 }
708 /**
709 * List the defined license families. Argument should be a LicenseFilter. (See Argument Types for clarification)
710 * @param outputFamilies The defined license families.
711 */
712 @Parameter(property = "rat.OutputFamilies", defaultValue = "NONE")
713 public void setOutputFamilies(String outputFamilies) {
714 setArg("output-families", outputFamilies);
715 }
716 /**
717 * Print information about registered licenses.
718 * @param helpLicenses The state
719 */
720 @Parameter(property = "rat.HelpLicenses")
721 public void setHelpLicenses(boolean helpLicenses) {
722 if (helpLicenses) {
723 setArg("help-licenses", null);
724 } else {
725 removeArg("help-licenses");
726 }
727 }
728 /**
729 * Name of file containing comma separated lists of denied license IDs. These license families will be removed from the list of approved licenses. Once license families are removed they can not be added back. Argument should be a File. (See Argument Types for clarification)
730 * @param licenseFamiliesDeniedFile Of file containing comma separated lists of denied license IDs.
731 */
732 @Parameter(property = "rat.LicenseFamiliesDeniedFile")
733 public void setLicenseFamiliesDeniedFile(String licenseFamiliesDeniedFile) {
734 setArg("license-families-denied-file", licenseFamiliesDeniedFile);
735 }
736 /**
737 * Includes files matching <Expression>. Will override excluded files. Arguments should be Expression. (See Argument Types for clarification)
738 * @param include Files matching <Expression>.
739 * @deprecated Deprecated for removal since 0.17: Use <inputInclude> instead.
740 */
741 @Deprecated
742 @Parameter
743 public void setIncludes(String[] include) {
744 addArg("include", include);
745 }
746 /**
747 * Includes files matching <Expression>. Will override excluded files. Arguments should be Expression. (See Argument Types for clarification)
748 * @param include Files matching <Expression>.
749 * @deprecated Deprecated for removal since 0.17: Use <inputInclude> instead.
750 */
751 @Deprecated
752 @Parameter
753 public void setInclude(String include) {
754 addArg("include", include);
755 }
756 /**
757 * Scans hidden directories.
758 * @param scanHiddenDirectories The state
759 * @deprecated Deprecated for removal since 0.17: Use <inputIncludeStd> with 'HIDDEN_DIR' argument instead.
760 */
761 @Deprecated
762 @Parameter(property = "rat.ScanHiddenDirectories")
763 public void setScanHiddenDirectories(boolean scanHiddenDirectories) {
764 if (scanHiddenDirectories) {
765 setArg("scan-hidden-directories", null);
766 } else {
767 removeArg("scan-hidden-directories");
768 }
769 }
770 /**
771 * forces XML output rather than the textual report.
772 * @param xml The state
773 * @deprecated Deprecated for removal since 0.17: Use <outputStyle> with the 'xml' argument instead.
774 */
775 @Deprecated
776 @Parameter(property = "rat.Xml")
777 public void setXml(boolean xml) {
778 if (xml) {
779 setArg("xml", null);
780 } else {
781 removeArg("xml");
782 }
783 }
784 /**
785 * Ignore default configuration.
786 * @param noDefaultLicenses The state
787 * @deprecated Deprecated for removal since 0.17: Use <configurationNoDefaults> instead.
788 */
789 @Deprecated
790 @Parameter(property = "rat.NoDefaultLicenses")
791 public void setNoDefaultLicenses(boolean noDefaultLicenses) {
792 if (noDefaultLicenses) {
793 setArg("no-default-licenses", null);
794 } else {
795 removeArg("no-default-licenses");
796 }
797 }
798 }