/** * Generates the Dependency-Check Site Report. * * @param sink the sink to write the report to * @param locale the locale to use when generating the report * @throws MavenReportException if a maven report exception occurs */ public void generate(Sink sink, Locale locale) throws MavenReportException { final boolean shouldSkip = Boolean.parseBoolean(System.getProperty("dependency-check.skip", Boolean.toString(skip))); if (shouldSkip) { getLog().info("Skipping report generation " + getName(Locale.US)); return; } generatingSite = true; try { validateAggregate(); } catch (MojoExecutionException ex) { throw new MavenReportException(ex.getMessage()); } project.setContextValue(getOutputDirectoryContextKey(), getReportOutputDirectory()); try { runCheck(); } catch (MojoExecutionException ex) { throw new MavenReportException(ex.getMessage(), ex); } catch (MojoFailureException ex) { getLog().warn("Vulnerabilities were identifies that exceed the CVSS threshold for failing the build"); } }
/** * @return true if the current report is external, false otherwise */ public boolean isExternalReport() { return report.isExternalReport(); } }
/** * {@inheritDoc} * * @see org.apache.maven.reporting.AbstractMavenReport#canGenerateReport() */ @Override public boolean canGenerateReport() { return super.canGenerateReport() && !skip; }
@Override public void generate( @SuppressWarnings("deprecation") Sink sink, Locale locale) throws MavenReportException { try { execute(); } catch (SphinxException e) { final MavenReportException cause = new MavenReportException(e.getMessage()); if (e.getCause() != null) { cause.initCause(e.getCause()); } throw cause; } catch (Exception e) { throw new MavenReportException("Error generating a Sphinx report:", e); } }
/** * The old generateReport from the Codehaus JDepend Mojo, * no longer used. * * @deprecated Use getReport() instead * @see getReport() */ public void generateReport(Locale locale) throws MavenReportException { throw new MavenReportException("Use getReport() instead!"); }
/** * {@inheritDoc} * * @see org.apache.maven.reporting.AbstractMavenReport#canGenerateReport() */ @Override public boolean canGenerateReport() { return super.canGenerateReport() && !skip; }
private void checkDeprecatedParameterUsage( Object parameter, String name, String replacement ) throws MavenReportException { if ( parameter != null ) { throw new MavenReportException( "You are using '" + name + "' which has been removed" + " from the maven-checkstyle-plugin. " + "Please use '" + replacement + "' and refer to the >>Major Version Upgrade to version 3.0.0<< " + "on the plugin site." ); } }
@Override public boolean canGenerateReport() { return hasReportDirectories() && super.canGenerateReport(); }
@Override public void executeReport(final Locale locale) throws MavenReportException { throw new MavenReportException("not supported"); }
@Override public boolean canGenerateReport() { return hasReportDirectories() && super.canGenerateReport(); }
@Override protected void executeReport(final Locale locale) throws MavenReportException { try { final Collection<MavenProject> allProjects = findDependencies(); final ReportAggregator.Builder reportAggregationBuilder = ReportAggregator .builder(); for (final MavenProject proj : allProjects) { addProjectFiles(reportAggregationBuilder, proj); } final ReportAggregator reportAggregator = reportAggregationBuilder .resultOutputStrategy(new DirectoryResultOutputStrategy( getReportsDirectory().getAbsolutePath(), new UndatedReportDirCreationStrategy())) .build(); reportAggregator.aggregateReport(); } catch (final Exception e) { throw new MavenReportException(e.getMessage(), e); } }
@SuppressWarnings("unchecked") private Comparator<UnitTestDoc> createComparator() throws MavenReportException { try { final Class<Comparator<UnitTestDoc>> type = (Class<Comparator<UnitTestDoc>>) Class.forName(unitTestDocComparator); return type.newInstance(); } catch (final ClassNotFoundException e) { throw new MavenReportException( "Unknown comparator type for unit test doc instances '" + unitTestDocComparator + "'.", e); } catch (final InstantiationException e) { throw new MavenReportException( "Cannot instantiate unit test doc comparator of type '" + unitTestDocComparator + "'.", e); } catch (final IllegalAccessException e) { throw new MavenReportException( "Cannot access unit test doc comparator of type '" + unitTestDocComparator + "'.", e); } }
@SuppressWarnings("unchecked") private Comparator<UnitTestDoc> createComparator() throws MavenReportException { try { final Class<Comparator<UnitTestDoc>> type = (Class<Comparator<UnitTestDoc>>) Class.forName(unitTestDocComparator); return type.newInstance(); } catch (final ClassNotFoundException e) { throw new MavenReportException( "Unknown comparator type for unit test doc instances '" + unitTestDocComparator + "'.", e); } catch (final InstantiationException e) { throw new MavenReportException( "Cannot instantiate unit test doc comparator of type '" + unitTestDocComparator + "'.", e); } catch (final IllegalAccessException e) { throw new MavenReportException( "Cannot access unit test doc comparator of type '" + unitTestDocComparator + "'.", e); } }
@Override public void generate(final org.codehaus.doxia.sink.Sink sink, final Locale locale) throws MavenReportException { try { execute(); } catch (MojoExecutionException ex) { throw new MavenReportException("Failed to exec report: " + this, ex); } }
/** * Ensures that the given directory is present and if not, creates it. * * @param directory the directory to be created. * @throws MavenReportException if the directory is not present and cannot be * created. */ public static void provideReportDirectory(final File directory) throws MavenReportException { if (!directory.exists()) { final boolean created = directory.mkdirs(); if (!created && !directory.exists()) { throw new MavenReportException("Cannot create directory: " + directory.getAbsolutePath()); } } }
private void generateReportStatics() throws MavenReportException { ReportResource rresource = new ReportResource( PLUGIN_RESOURCES, outputDirectory ); try { rresource.copy( "images/rss.png" ); } catch ( IOException e ) { throw new MavenReportException( "Unable to copy static resources.", e ); } }
/** * {@inheritDoc} */ protected void executeReport( Locale locale ) throws MavenReportException { if ( !skip ) { try { doGenerateReport( locale, getSink() ); } catch ( MojoExecutionException e ) { throw new MavenReportException( e.getMessage(), e ); } } }
private TestOutcomes generateHtmlReports() throws MavenReportException { getReporter().setOutputDirectory(getThucydidesOutputDirectory()); try { return getReporter().generateReportsForTestResultsFrom(sourceDirectory); } catch (IOException e) { throw new MavenReportException("Error generating aggregate thucydides reports", e); } }