if (options.hasOption(CACHE)) {
try {
startParameter.setCacheUsage(CacheUsage.fromString(options.option(CACHE).getValue()));
} catch (InvalidUserDataException e) {
throw new CommandLineArgumentException(e.getMessage());
}
}
if (options.hasOption(EMBEDDED_SCRIPT)) {
if (options.hasOption(BUILD_FILE) || options.hasOption(NO_SEARCH_UPWARDS) || options.hasOption(SETTINGS_FILE)) {
System.err.println(String.format(
"Error: The -%s option can't be used together with the -%s, -%s or -%s options.",
EMBEDDED_SCRIPT, BUILD_FILE, SETTINGS_FILE, NO_SEARCH_UPWARDS));
throw new CommandLineArgumentException(String.format(
"Error: The -%s option can't be used together with the -%s, -%s or -%s options.",
EMBEDDED_SCRIPT, BUILD_FILE, SETTINGS_FILE, NO_SEARCH_UPWARDS));
}
startParameter.useEmbeddedBuildFile(options.option(EMBEDDED_SCRIPT).getValue());
}
if (options.hasOption(FULL_STACKTRACE)) {
if (options.hasOption(STACKTRACE)) {
throw new CommandLineArgumentException(String.format(
"Error: The -%s option can't be used together with the -%s option.", FULL_STACKTRACE,
STACKTRACE));
}
startParameter.setShowStacktrace(StartParameter.ShowStacktrace.ALWAYS_FULL);
} else if (options.hasOption(STACKTRACE)) {
startParameter.setShowStacktrace(StartParameter.ShowStacktrace.ALWAYS);
}
if (options.hasOption(PROJECT_DEPENDENCY_TASK_NAMES) && options.hasOption(NO_PROJECT_DEPENDENCY_REBUILD)) {
throw new CommandLineArgumentException(String.format(
"Error: The -%s and -%s options cannot be used together.", PROJECT_DEPENDENCY_TASK_NAMES,
NO_PROJECT_DEPENDENCY_REBUILD));
} else if (options.hasOption(NO_PROJECT_DEPENDENCY_REBUILD)) {
startParameter.setProjectDependenciesBuildInstruction(new ProjectDependenciesBuildInstruction(null));
} else if (options.hasOption(PROJECT_DEPENDENCY_TASK_NAMES)) {