/** * 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"); } }
@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); } }
/** * 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!"); }
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 void executeReport(final Locale locale) throws MavenReportException { throw new MavenReportException("not supported"); }
@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); } }
public void generate(Sink sink, Locale locale) throws MavenReportException { // for some reason, when running in the "site" lifecycle, the context classloader // doesn't get set up the same way it does when doing the default lifecycle // so we have to set it up manually here. ClassLoader old = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); execute(); } catch (MojoExecutionException e) { throw new MavenReportException("Unable to generate web service documentation report", e); } finally { Thread.currentThread().setContextClassLoader(old); } }
private void runSphinx() throws MavenReportException { if (verbose) { getLog().info("Running sphinx on " + sourceDirectory.getAbsolutePath() + ", output will be placed in " + outputDirectory.getAbsolutePath()); } String[] args = getSphinxRunnerCmdLine(); int result; try { result = SphinxRunner.run(args); } catch (Exception ex) { throw new MavenReportException("Could not generate documentation", ex); } if (result != 0) { throw new MavenReportException("Sphinx report generation failed"); } }
/** * Read model instance. * @return The model just read * @throws MavenReportException If something goes wrong */ private Model model() throws MavenReportException { try { final InputStream input = new FileInputStream(this.xmi); try { return new SimpleModel().load(input); } finally { input.close(); } } catch (final IOException ex) { throw new MavenReportException("failed to report", ex); } }
public void generate(Sink sink, Locale locale) throws MavenReportException { if (this.siteError != null) { throw new MavenReportException("Unable to generate Enunciate documentation.", this.siteError); } //first get rid of the empty page the the site plugin puts there, in order to make room for the documentation. new File(getReportOutputDirectory(), this.indexPageName == null ? "index.html" : this.indexPageName).delete(); Enunciate enunciate = (Enunciate) getPluginContext().get(ConfigMojo.ENUNCIATE_PROPERTY); try { enunciate.copyDir(getReportStagingDirectory(), getReportOutputDirectory()); } catch (IOException e) { throw new MavenReportException("Unable to copy Enunciate documentation from the staging area to the report directory.", e); } }
public void generate(Sink sink, Locale locale) throws MavenReportException { if (this.siteError != null) { throw new MavenReportException("Unable to generate Enunciate documentation.", this.siteError); } //first get rid of the empty page the the site plugin puts there, in order to make room for the documentation. new File(getReportOutputDirectory(), this.indexPageName == null ? "index.html" : this.indexPageName).delete(); Enunciate enunciate = (Enunciate) getPluginContext().get(ConfigMojo.ENUNCIATE_PROPERTY); try { enunciate.copyDir(getReportStagingDirectory(), getReportOutputDirectory()); } catch (IOException e) { throw new MavenReportException("Unable to copy Enunciate documentation from the staging area to the report directory.", e); } }
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 ); } }
protected void generateReport(List<Path> resultsPaths) throws MavenReportException { try { Path reportPath = Paths.get(getReportDirectory()); AllureCommandline commandline = new AllureCommandline(Paths.get(getInstallDirectory()), reportVersion, reportTimeout); getLog().info("Generate report to " + reportPath); commandline.generateReport(resultsPaths, reportPath); getLog().info("Report generated successfully."); } catch (Exception e) { getLog().error("Can't generate allure report data", e); throw new MavenReportException("Can't generate allure report data", e); } }
@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); } }
protected void generateReport(List<Path> resultsPaths) throws MavenReportException { try { Path reportPath = Paths.get(getReportDirectory()); AllureCommandline commandline = new AllureCommandline(Paths.get(getInstallDirectory()), reportVersion, this.serveTimeout); getLog().info("Generate report to " + reportPath); commandline.serve(resultsPaths, reportPath, this.serveHost, this.servePort); getLog().info("Report generated successfully."); } catch (Exception e) { getLog().error("Can't generate allure report data", e); throw new MavenReportException("Can't generate allure report data", e); } }
private void installAllure() throws MavenReportException{ try { final String version = reportVersion != null ? reportVersion : ALLURE_DEFAULT_VERSION; getLog().info(String.format("Allure installation directory %s", installDirectory)); getLog().info(String.format("Try to finding out allure %s", version)); AllureCommandline commandline = new AllureCommandline(Paths.get(installDirectory), reportVersion); if (commandline.allureNotExists()) { final String url = getAllureDownloadUrl(version, allureDownloadUrl); getLog().info("Downloading allure commandline..."); commandline.download(url, ProxyUtils.getProxy(session, decrypter)); getLog().info("Downloading allure commandline complete"); } } catch (Exception e) { getLog().error("Can't install allure", e); throw new MavenReportException("Can't install allure", 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); } }
protected void doGenerateReport( Locale locale, Sink sink ) throws MavenReportException { final Map<Property, PropertyVersions> updateSet; try { updateSet = getHelper().getVersionPropertiesMap( getProject(), properties, includeProperties, excludeProperties, autoLinkItems ); } catch ( MojoExecutionException e ) { throw new MavenReportException( e.getMessage(), e ); } PropertyUpdatesRenderer renderer = new PropertyUpdatesRenderer( sink, getI18n(), getOutputName(), locale, updateSet ); renderer.render(); }
protected void doGenerateReport( Locale locale, Sink sink ) throws MavenReportException { final Map<Property, PropertyVersions> updateSet; try { updateSet = getHelper().getVersionPropertiesMap( getProject(), properties, includeProperties, excludeProperties, autoLinkItems ); } catch ( MojoExecutionException e ) { throw new MavenReportException( e.getMessage(), e ); } PropertyUpdatesRenderer renderer = new PropertyUpdatesRenderer( sink, getI18n(), getOutputName(), locale, updateSet ); renderer.render(); }