renaming app argument to project per issue #320

This commit is contained in:
Jeremy Long
2015-08-29 06:48:52 -04:00
parent 1e447c6e3e
commit 7a8f7199c8
3 changed files with 27 additions and 9 deletions

View File

@@ -98,7 +98,7 @@ public class App {
} else if (cli.isRunScan()) { } else if (cli.isRunScan()) {
populateSettings(cli); populateSettings(cli);
try { try {
runScan(cli.getReportDirectory(), cli.getReportFormat(), cli.getApplicationName(), cli.getScanFiles(), runScan(cli.getReportDirectory(), cli.getReportFormat(), cli.getProjectName(), cli.getScanFiles(),
cli.getExcludeList(), cli.getSymLinkDepth()); cli.getExcludeList(), cli.getSymLinkDepth());
} catch (InvalidScanPathException ex) { } catch (InvalidScanPathException ex) {
LOGGER.error("An invalid scan path was detected; unable to scan '//*' paths"); LOGGER.error("An invalid scan path was detected; unable to scan '//*' paths");

View File

@@ -97,8 +97,8 @@ public final class CliParser {
if (getPathToMono() != null) { if (getPathToMono() != null) {
validatePathExists(getPathToMono(), ARGUMENT.PATH_TO_MONO); validatePathExists(getPathToMono(), ARGUMENT.PATH_TO_MONO);
} }
if (!line.hasOption(ARGUMENT.APP_NAME)) { if (!line.hasOption(ARGUMENT.APP_NAME) && !line.hasOption(ARGUMENT.PROJECT)) {
throw new ParseException("Missing 'app' argument; the scan cannot be run without the an application name."); throw new ParseException("Missing '" + ARGUMENT.PROJECT + "' argument; the scan cannot be run without the an project name.");
} }
if (line.hasOption(ARGUMENT.OUTPUT_FORMAT)) { if (line.hasOption(ARGUMENT.OUTPUT_FORMAT)) {
final String format = line.getOptionValue(ARGUMENT.OUTPUT_FORMAT); final String format = line.getOptionValue(ARGUMENT.OUTPUT_FORMAT);
@@ -217,9 +217,9 @@ public final class CliParser {
final Option noUpdate = new Option(ARGUMENT.DISABLE_AUTO_UPDATE_SHORT, ARGUMENT.DISABLE_AUTO_UPDATE, final Option noUpdate = new Option(ARGUMENT.DISABLE_AUTO_UPDATE_SHORT, ARGUMENT.DISABLE_AUTO_UPDATE,
false, "Disables the automatic updating of the CPE data."); false, "Disables the automatic updating of the CPE data.");
final Option appName = OptionBuilder.withArgName("name").hasArg().withLongOpt(ARGUMENT.APP_NAME) final Option projectName = OptionBuilder.withArgName("name").hasArg().withLongOpt(ARGUMENT.PROJECT)
.withDescription("The name of the application being scanned. This is a required argument.") .withDescription("The name of the project being scanned. This is a required argument.")
.create(ARGUMENT.APP_NAME_SHORT); .create();
final Option path = OptionBuilder.withArgName("path").hasArg().withLongOpt(ARGUMENT.SCAN) final Option path = OptionBuilder.withArgName("path").hasArg().withLongOpt(ARGUMENT.SCAN)
.withDescription("The path to scan - this option can be specified multiple times. Ant style" .withDescription("The path to scan - this option can be specified multiple times. Ant style"
@@ -267,7 +267,7 @@ public final class CliParser {
.addOptionGroup(exog) .addOptionGroup(exog)
.addOption(out) .addOption(out)
.addOption(outputFormat) .addOption(outputFormat)
.addOption(appName) .addOption(projectName)
.addOption(version) .addOption(version)
.addOption(help) .addOption(help)
.addOption(advancedHelp) .addOption(advancedHelp)
@@ -444,8 +444,12 @@ public final class CliParser {
final Option proxyServer = OptionBuilder.withArgName("url").hasArg().withLongOpt(ARGUMENT.PROXY_URL) final Option proxyServer = OptionBuilder.withArgName("url").hasArg().withLongOpt(ARGUMENT.PROXY_URL)
.withDescription("The proxy url argument is deprecated, use proxyserver instead.") .withDescription("The proxy url argument is deprecated, use proxyserver instead.")
.create(); .create();
final Option appName = OptionBuilder.withArgName("name").hasArg().withLongOpt(ARGUMENT.APP_NAME)
.withDescription("The name of the project being scanned. This is a required argument.")
.create(ARGUMENT.APP_NAME_SHORT);
options.addOption(proxyServer); options.addOption(proxyServer);
options.addOption(appName);
} }
/** /**
@@ -715,8 +719,14 @@ public final class CliParser {
* *
* @return the application name. * @return the application name.
*/ */
public String getApplicationName() { public String getProjectName() {
return line.getOptionValue(ARGUMENT.APP_NAME); String appName = line.getOptionValue(ARGUMENT.APP_NAME);
String name = line.getOptionValue(ARGUMENT.PROJECT);
if (name == null && appName != null) {
name = appName;
LOGGER.warn("The '" + ARGUMENT.APP_NAME + "' should no longer be used; use '" + ARGUMENT.PROJECT + "' instead.");
}
return name;
} }
/** /**
@@ -975,13 +985,19 @@ public final class CliParser {
* The short CLI argument name specifying the output format to write the reports to. * The short CLI argument name specifying the output format to write the reports to.
*/ */
public static final String OUTPUT_FORMAT_SHORT = "f"; public static final String OUTPUT_FORMAT_SHORT = "f";
/**
* The long CLI argument name specifying the name of the project to be scanned.
*/
public static final String PROJECT = "project";
/** /**
* The long CLI argument name specifying the name of the application to be scanned. * The long CLI argument name specifying the name of the application to be scanned.
*/ */
@Deprecated
public static final String APP_NAME = "app"; public static final String APP_NAME = "app";
/** /**
* The short CLI argument name specifying the name of the application to be scanned. * The short CLI argument name specifying the name of the application to be scanned.
*/ */
@Deprecated
public static final String APP_NAME_SHORT = "a"; public static final String APP_NAME_SHORT = "a";
/** /**
* The long CLI argument name asking for help. * The long CLI argument name asking for help.

View File

@@ -119,6 +119,8 @@ public class AggregateMojo extends BaseDependencyCheckMojo {
//we shouldn't write this because nothing is configured to generate this report. //we shouldn't write this because nothing is configured to generate this report.
outputDir = new File(current.getBuild().getDirectory()); outputDir = new File(current.getBuild().getDirectory());
} }
getLog().warn("\n\n\nwritting: " + outputDir);
getLog().warn("for: " + current.getName());
writeReports(engine, current, outputDir); writeReports(engine, current, outputDir);
} }
} }