From b29387364031dd22dc4e532aafa74effebe23fa2 Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Sat, 29 Aug 2015 07:12:40 -0400 Subject: [PATCH] finished deprecating the application name argument in favor of project name per issue #320 --- .../taskdefs/DependencyCheckTask.java | 37 +++++++++++++++++-- .../src/site/markdown/configuration.md | 4 +- .../src/site/markdown/arguments.md | 2 +- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/DependencyCheckTask.java b/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/DependencyCheckTask.java index c06f2ac77..6892dc63a 100644 --- a/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/DependencyCheckTask.java +++ b/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/DependencyCheckTask.java @@ -145,13 +145,15 @@ public class DependencyCheckTask extends Task { /** * The application name for the report. */ - private String applicationName = "Dependency-Check"; + @Deprecated + private String applicationName = null; /** * Get the value of applicationName. * * @return the value of applicationName */ + @Deprecated public String getApplicationName() { return applicationName; } @@ -161,9 +163,37 @@ public class DependencyCheckTask extends Task { * * @param applicationName new value of applicationName */ + @Deprecated public void setApplicationName(String applicationName) { this.applicationName = applicationName; } + + private String projectName = "Dependency-Check"; + + /** + * Get the value of projectName. + * + * @return the value of projectName + */ + public String getProjectName() { + if (applicationName != null) { + log("Configuration 'applicationName' has been deprecated, please use 'projectName' instead", Project.MSG_WARN); + if ("Dependency-Check".equals(projectName)) { + projectName = applicationName; + } + } + return projectName; + } + + /** + * Set the value of projectName. + * + * @param projectName new value of projectName + */ + public void setProjectName(String projectName) { + this.projectName = projectName; + } + /** * The location of the data directory that contains */ @@ -279,8 +309,7 @@ public class DependencyCheckTask extends Task { } /** - * The report format to be generated (HTML, XML, VULN, ALL). This configuration option has no affect if using this within the - * Site plugin unless the externalReport is set to true. Default is HTML. + * The report format to be generated (HTML, XML, VULN, ALL). Default is HTML. */ private String reportFormat = "HTML"; @@ -933,7 +962,7 @@ public class DependencyCheckTask extends Task { cve.close(); } } - final ReportGenerator reporter = new ReportGenerator(applicationName, engine.getDependencies(), engine.getAnalyzers(), prop); + final ReportGenerator reporter = new ReportGenerator(getProjectName(), engine.getDependencies(), engine.getAnalyzers(), prop); reporter.generateReports(reportOutputDirectory, reportFormat); if (this.failBuildOnCVSS <= 10) { diff --git a/dependency-check-ant/src/site/markdown/configuration.md b/dependency-check-ant/src/site/markdown/configuration.md index 7534f128c..3b751cfc3 100644 --- a/dependency-check-ant/src/site/markdown/configuration.md +++ b/dependency-check-ant/src/site/markdown/configuration.md @@ -8,7 +8,7 @@ the project's dependencies. ```xml - @@ -27,7 +27,7 @@ Property | Description | Default Value ----------------------|------------------------------------|------------------ autoUpdate | Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not recommended that this be turned to false. | true updateOnly | If set to true only the update phase of dependency-check will be executed; no scan will be executed and no report will be generated. | false -externalReport | When using as a Site plugin this parameter sets whether or not the external report format should be used. | false +projectName | The name of the project being scanned. | Dependency-Check reportOutputDirectory | The location to write the report(s). Note, this is not used if generating the report as part of a `mvn site` build | 'target' failBuildOnCVSS | Specifies if the build should be failed if a CVSS score above a specified level is identified. The default is 11 which means since the CVSS scores are 0-10, by default the build will never fail. | 11 reportFormat | The report format to be generated (HTML, XML, VULN, ALL). This configuration option has no affect if using this within the Site plugin unless the externalReport is set to true. | HTML diff --git a/dependency-check-cli/src/site/markdown/arguments.md b/dependency-check-cli/src/site/markdown/arguments.md index ededf1f2d..0a22250ee 100644 --- a/dependency-check-cli/src/site/markdown/arguments.md +++ b/dependency-check-cli/src/site/markdown/arguments.md @@ -5,7 +5,7 @@ The following table lists the command line arguments: Short | Argument Name   | Parameter | Description | Requirement -------|-----------------------|-----------------|-------------|------------ - \-a | \-\-app | \ | The name of the application being scanned. This is a required argument. | Required + | \-\-project | \ | The name of the project being scanned. | Required \-s | \-\-scan | \ | The path to scan \- this option can be specified multiple times. It is also possible to specify Ant style paths (e.g. directory/**/*.jar). | Required | \-\-exclude | \ | The path patterns to exclude from the scan \- this option can be specified multiple times. This accepts Ant style path patterns (e.g. **/exclude/**). | Optional | \-\-symLink | \ | The depth that symbolic links will be followed; the default is 0 meaning symbolic links will not be followed. | Optional