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