protected void runCheck ( ) throws MojoExecutionException , MojoFailureException { try ( Engine engine = initializeEngine ( ) ) { ExceptionCollection exCol = scanDependencies ( engine ) ; try { engine . analyzeDependencies ( ) ; } catch ( ExceptionCollection ex ) { exCol = handleAnalysisExceptions ( exCol , ex ) ; } if ( exCol == null || ! exCol . isFatal ( ) ) { File outputDir = getCorrectOutputDirectory ( this . getProject ( ) ) ; if ( outputDir == null ) { //in some regards we shouldn't be writing this, but we are anyway. //we shouldn't write this because nothing is configured to generate this report. outputDir = new File ( this . getProject ( ) . getBuild ( ) . getDirectory ( ) ) ; } try { final MavenProject p = this . getProject ( ) ; engine . writeReports ( p . getName ( ) , p . getGroupId ( ) , p . getArtifactId ( ) , p . getVersion ( ) , outputDir , getFormat ( ) ) ; } catch ( ReportException ex ) { if ( exCol == null ) { exCol = new ExceptionCollection ( ex ) ; } else { exCol . addException ( ex ) ; } if ( this . isFailOnError ( ) ) { throw new MojoExecutionException ( "One or more exceptions occurred during dependency-check analysis" , exCol ) ; } else { getLog ( ) . debug ( "Error writing the report" , ex ) ; } } showSummary ( this . getProject ( ) , engine . getDependencies ( ) ) ; checkForFailure ( engine . getDependencies ( ) ) ; if ( exCol != null && this . isFailOnError ( ) ) { throw new MojoExecutionException ( "One or more exceptions occurred during dependency-check analysis" , exCol ) ; } } } catch ( DatabaseException ex ) { if ( getLog ( ) . isDebugEnabled ( ) ) { getLog ( ) . debug ( "Database connection error" , ex ) ; } final String msg = "An exception occurred connecting to the local database. Please see the log file for more details." ; if ( this . isFailOnError ( ) ) { throw new MojoExecutionException ( msg , ex ) ; } getLog ( ) . error ( msg , ex ) ; } finally { getSettings ( ) . cleanup ( ) ; } }
Executes the dependency - check scan and generates the necessary report .