dependency-check-maven/src/main/java/org/owasp/dependencycheck/maven/AggregateMojo.java
/**
     * Executes the aggregate dependency-check goal. This runs dependency-check
     * and generates the subsequent reports.
     *
     * @throws MojoExecutionException thrown if there is ane exception running
     * the Mojo
     * @throws MojoFailureException thrown if dependency-check is configured to
     * fail the build
     */
Executes the aggregate dependency-check goal. This runs dependency-check
and generates the subsequent reports.

@throws MojoExecutionException thrown if there is ane exception running
the Mojo
@throws MojoFailureException thrown if dependency-check is configured to
fail the build
Executes the aggregate dependency - check goal . This runs dependency - check and generates the subsequent reports . @throws MojoExecutionException thrown if there is ane exception running the Mojo @throws MojoFailureException thrown if dependency - check is configured to fail the build
@Override
    public void runCheck() throws MojoExecutionException, MojoFailureException {
        final Engine engine = loadEngine();
        if (engine == null) {
            return;
        }
        ExceptionCollection exCol = scanArtifacts(getProject(), engine);
        for (MavenProject childProject : getDescendants(this.getProject())) {
            final ExceptionCollection ex = scanArtifacts(childProject, engine);
            if (ex != null) {
                if (exCol == null) {
                    exCol = ex;
                }
                exCol.getExceptions().addAll(ex.getExceptions());
                if (ex.isFatal()) {
                    exCol.setFatal(true);
                    final String msg = String.format("Fatal exception(s) analyzing %s", childProject.getName());
                    if (this.isFailOnError()) {
                        throw new MojoExecutionException(msg, exCol);
                    }
                    getLog().error(msg);
                    if (getLog().isDebugEnabled()) {
                        getLog().debug(exCol);
                    }
                }
            }
        }
        try {
            engine.analyzeDependencies();
        } catch (ExceptionCollection ex) {
            if (exCol == null) {
                exCol = ex;
            } else if (ex.isFatal()) {
                exCol.setFatal(true);
                exCol.getExceptions().addAll(ex.getExceptions());
            }
            if (exCol.isFatal()) {
                final String msg = String.format("Fatal exception(s) analyzing %s", getProject().getName());
                if (this.isFailOnError()) {
                    throw new MojoExecutionException(msg, exCol);
                }
                getLog().error(msg);
                if (getLog().isDebugEnabled()) {
                    getLog().debug(exCol);
                }
                return;
            } else {
                final String msg = String.format("Exception(s) analyzing %s", getProject().getName());
                if (getLog().isDebugEnabled()) {
                    getLog().debug(msg, exCol);
                }
            }
        }
        File outputDir = getCorrectOutputDirectory(this.getProject());
        if (outputDir == null) {
            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("Error writing aggregate report", ex);
            } else {
                exCol.addException(ex);
            }
            if (this.isFailOnError()) {
                throw new MojoExecutionException("One or more exceptions occurred during dependency-check analysis", exCol);
            } else {
                getLog().debug("One or more exceptions occurred during dependency-check analysis", exCol);
            }
        }
        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);
        }
        engine.cleanup();
        Settings.cleanup();
    }
@ Override public void runCheck ( ) throws MojoExecutionException , MojoFailureException { final Engine engine = loadEngine ( ) ; if ( engine == null ) { return ; } ExceptionCollection exCol = scanArtifacts ( getProject ( ) , engine ) ; for ( MavenProject childProject : getDescendants ( this . getProject ( ) ) ) { final ExceptionCollection ex = scanArtifacts ( childProject , engine ) ; if ( ex != null ) { if ( exCol == null ) { exCol = ex ; } exCol . getExceptions ( ) . addAll ( ex . getExceptions ( ) ) ; if ( ex . isFatal ( ) ) { exCol . setFatal ( true ) ; final String msg = String . format ( "Fatal exception(s) analyzing %s" , childProject . getName ( ) ) ; if ( this . isFailOnError ( ) ) { throw new MojoExecutionException ( msg , exCol ) ; } getLog ( ) . error ( msg ) ; if ( getLog ( ) . isDebugEnabled ( ) ) { getLog ( ) . debug ( exCol ) ; } } } } try { engine . analyzeDependencies ( ) ; } catch ( ExceptionCollection ex ) { if ( exCol == null ) { exCol = ex ; } else if ( ex . isFatal ( ) ) { exCol . setFatal ( true ) ; exCol . getExceptions ( ) . addAll ( ex . getExceptions ( ) ) ; } if ( exCol . isFatal ( ) ) { final String msg = String . format ( "Fatal exception(s) analyzing %s" , getProject ( ) . getName ( ) ) ; if ( this . isFailOnError ( ) ) { throw new MojoExecutionException ( msg , exCol ) ; } getLog ( ) . error ( msg ) ; if ( getLog ( ) . isDebugEnabled ( ) ) { getLog ( ) . debug ( exCol ) ; } return ; } else { final String msg = String . format ( "Exception(s) analyzing %s" , getProject ( ) . getName ( ) ) ; if ( getLog ( ) . isDebugEnabled ( ) ) { getLog ( ) . debug ( msg , exCol ) ; } } } File outputDir = getCorrectOutputDirectory ( this . getProject ( ) ) ; if ( outputDir == null ) { 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 ( "Error writing aggregate report" , ex ) ; } else { exCol . addException ( ex ) ; } if ( this . isFailOnError ( ) ) { throw new MojoExecutionException ( "One or more exceptions occurred during dependency-check analysis" , exCol ) ; } else { getLog ( ) . debug ( "One or more exceptions occurred during dependency-check analysis" , exCol ) ; } } 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 ) ; } engine . cleanup ( ) ; Settings . cleanup ( ) ; }
Executes the aggregate dependency-check goal.
Executes the aggregate dependency - check goal .
//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.