org.owasp.dependencycheck.maven
Class DependencyCheckMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.owasp.dependencycheck.maven.DependencyCheckMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.apache.maven.reporting.MavenMultiPageReport, org.apache.maven.reporting.MavenReport

@Mojo(name="check",
      defaultPhase=COMPILE,
      threadSafe=true,
      requiresDependencyResolution=RUNTIME_PLUS_SYSTEM,
      requiresOnline=true)
public class DependencyCheckMojo
extends org.apache.maven.plugin.AbstractMojo
implements org.apache.maven.reporting.MavenMultiPageReport

Maven Plugin that checks project dependencies to see if they have any known published vulnerabilities.

Author:
Jeremy Long (jeremy.long@owasp.org)

Field Summary
static String TEST_SCOPE
          The name of the test scope.
 
Fields inherited from interface org.apache.maven.reporting.MavenReport
CATEGORY_PROJECT_INFORMATION, CATEGORY_PROJECT_REPORTS, ROLE
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
DependencyCheckMojo()
           
 
Method Summary
 boolean canGenerateReport()
          Returns whether or not the plugin can generate a report.
 void execute()
          Executes the dependency-check and generates the report.
 void generate(org.codehaus.doxia.sink.Sink sink, Locale locale)
          Generates the Dependency-Check Site Report.
 void generate(org.apache.maven.doxia.sink.Sink sink, org.apache.maven.doxia.sink.SinkFactory sinkFactory, Locale locale)
          Generates the Dependency-Check Site Report.
 String getCategoryName()
          Returns the category name.
 String getDescription(Locale locale)
          Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page.
 String getName(Locale locale)
          Returns the report name.
 String getOutputName()
          Returns the output name.
 File getReportOutputDirectory()
          Returns the output directory.
 boolean isExternalReport()
          Returns whether this is an external report.
 void setReportOutputDirectory(File directory)
          Sets the Reporting output directory.
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEST_SCOPE

public static final String TEST_SCOPE
The name of the test scope.

See Also:
Constant Field Values
Constructor Detail

DependencyCheckMojo

public DependencyCheckMojo()
Method Detail

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException,
                    org.apache.maven.plugin.MojoFailureException
Executes the dependency-check and generates the report.

Specified by:
execute in interface org.apache.maven.plugin.Mojo
Throws:
org.apache.maven.plugin.MojoExecutionException - if a maven exception occurs
org.apache.maven.plugin.MojoFailureException - thrown if a CVSS score is found that is higher then the configured level

generate

public void generate(org.codehaus.doxia.sink.Sink sink,
                     Locale locale)
              throws org.apache.maven.reporting.MavenReportException
Generates the Dependency-Check Site Report.

Specified by:
generate in interface org.apache.maven.reporting.MavenReport
Parameters:
sink - the sink to write the report to
locale - the locale to use when generating the report
Throws:
org.apache.maven.reporting.MavenReportException - if a Maven report exception occurs

generate

public void generate(org.apache.maven.doxia.sink.Sink sink,
                     org.apache.maven.doxia.sink.SinkFactory sinkFactory,
                     Locale locale)
              throws org.apache.maven.reporting.MavenReportException
Generates the Dependency-Check Site Report.

Specified by:
generate in interface org.apache.maven.reporting.MavenMultiPageReport
Parameters:
sink - the sink to write the report to
sinkFactory - the sink factory
locale - the locale to use when generating the report
Throws:
org.apache.maven.reporting.MavenReportException - if a maven report exception occurs

getOutputName

public String getOutputName()
Returns the output name.

Specified by:
getOutputName in interface org.apache.maven.reporting.MavenReport
Returns:
the output name

getCategoryName

public String getCategoryName()
Returns the category name.

Specified by:
getCategoryName in interface org.apache.maven.reporting.MavenReport
Returns:
the category name

getName

public String getName(Locale locale)
Returns the report name.

Specified by:
getName in interface org.apache.maven.reporting.MavenReport
Parameters:
locale - the location
Returns:
the report name

setReportOutputDirectory

public void setReportOutputDirectory(File directory)
Sets the Reporting output directory.

Specified by:
setReportOutputDirectory in interface org.apache.maven.reporting.MavenReport
Parameters:
directory - the output directory

getReportOutputDirectory

public File getReportOutputDirectory()
Returns the output directory.

Specified by:
getReportOutputDirectory in interface org.apache.maven.reporting.MavenReport
Returns:
the output directory

getDescription

public String getDescription(Locale locale)
Gets the description of the Dependency-Check report to be displayed in the Maven Generated Reports page.

Specified by:
getDescription in interface org.apache.maven.reporting.MavenReport
Parameters:
locale - The Locale to get the description for
Returns:
the description

isExternalReport

public boolean isExternalReport()
Returns whether this is an external report.

Specified by:
isExternalReport in interface org.apache.maven.reporting.MavenReport
Returns:
true or false;

canGenerateReport

public boolean canGenerateReport()
Returns whether or not the plugin can generate a report.

Specified by:
canGenerateReport in interface org.apache.maven.reporting.MavenReport
Returns:
true


Copyright © 2013 OWASP. All Rights Reserved.