Added basic skip option for mojos.

This commit is contained in:
Anthony Whitford
2015-10-11 18:44:25 -07:00
parent 38e61ebd8d
commit 79fde3ebc9

View File

@@ -246,6 +246,12 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
*/ */
@Parameter(property = "zipExtensions", required = false) @Parameter(property = "zipExtensions", required = false)
private String zipExtensions; private String zipExtensions;
/**
* Skip Dependency Check altogether.
*/
@SuppressWarnings("CanBeFinal")
@Parameter(property = "dependency-check.skip", defaultValue = "false", required = false)
private boolean skip = false;
/** /**
* Skip Analysis for Test Scope Dependencies. * Skip Analysis for Test Scope Dependencies.
*/ */
@@ -325,10 +331,14 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
*/ */
@Override @Override
public void execute() throws MojoExecutionException, MojoFailureException { public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
getLog().info("Skipping " + getName(Locale.US));
} else {
validateAggregate(); validateAggregate();
project.setContextValue(getOutputDirectoryContextKey(), this.outputDirectory); project.setContextValue(getOutputDirectoryContextKey(), this.outputDirectory);
runCheck(); runCheck();
} }
}
/** /**
* Checks if the aggregate configuration parameter has been set to true. If it has a MojoExecutionException is thrown because * Checks if the aggregate configuration parameter has been set to true. If it has a MojoExecutionException is thrown because