Search in sources :

Example 16 with Sink

use of org.apache.maven.doxia.sink.Sink in project felix by apache.

the class BaselineReport method startPackage.

@Override
protected void startPackage(final Object context, boolean mismatch, String packageName, String shortDelta, String delta, Version newerVersion, Version olderVersion, Version suggestedVersion, DiffMessage diffMessage, Map<String, String> attributes) {
    final Context ctx = (Context) context;
    final Sink sink = ctx.sink;
    sink.list();
    sink.listItem();
    sink.figure();
    sink.figureGraphics("./images/baseline/package.gif");
    sink.figure_();
    sink.text(" ");
    sink.monospaced();
    sink.text(packageName);
    sink.monospaced_();
    if (diffMessage != null) {
        sink.text(" ");
        sink.figure();
        sink.figureGraphics("./images/baseline/" + diffMessage.getType().name() + ".gif");
        sink.figure_();
        sink.text(" ");
        sink.italic();
        sink.text(diffMessage.getMessage());
        sink.italic_();
        sink.text(" (newer version: ");
        sink.monospaced();
        sink.text(newerVersion.toString());
        sink.monospaced_();
        sink.text(", older version: ");
        sink.monospaced();
        sink.text(olderVersion.toString());
        if (suggestedVersion != null) {
            sink.monospaced_();
            sink.text(", suggested version: ");
            sink.monospaced();
            sink.text(suggestedVersion.toString());
        }
        sink.monospaced_();
        sink.text(")");
    }
}
Also used : Sink(org.apache.maven.doxia.sink.Sink)

Example 17 with Sink

use of org.apache.maven.doxia.sink.Sink in project maven-dependency-plugin by apache.

the class AnalyzeReportMojo method executeReport.

// Mojo methods -----------------------------------------------------------
/*
     * @see org.apache.maven.plugin.Mojo#execute()
     */
@Override
public void executeReport(Locale locale) throws MavenReportException {
    if (skip) {
        getLog().info("Skipping plugin execution");
        return;
    }
    // Step 0: Checking pom availability
    if ("pom".equals(project.getPackaging())) {
        getLog().info("Skipping pom project");
        return;
    }
    if (outputDirectory == null || !outputDirectory.exists()) {
        getLog().info("Skipping project with no Target directory");
        return;
    }
    // Step 1: Analyze the project
    ProjectDependencyAnalysis analysis;
    try {
        analysis = analyzer.analyze(project);
        if (usedDependencies != null) {
            analysis = analysis.forceDeclaredDependenciesUsage(usedDependencies);
        }
    } catch (ProjectDependencyAnalyzerException exception) {
        throw new MavenReportException("Cannot analyze dependencies", exception);
    }
    // remove everything that's not in the compile scope
    if (ignoreNonCompile) {
        analysis = analysis.ignoreNonCompile();
    }
    // Step 2: Create sink and bundle
    Sink sink = getSink();
    ResourceBundle bundle = getBundle(locale);
    // Step 3: Generate the report
    AnalyzeReportView analyzethis = new AnalyzeReportView();
    analyzethis.generateReport(analysis, sink, bundle);
}
Also used : ProjectDependencyAnalysis(org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis) ProjectDependencyAnalyzerException(org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException) Sink(org.apache.maven.doxia.sink.Sink) ResourceBundle(java.util.ResourceBundle) MavenReportException(org.apache.maven.reporting.MavenReportException)

Example 18 with Sink

use of org.apache.maven.doxia.sink.Sink in project maven-plugins by apache.

the class InvokerReport method renderBuildJob.

private void renderBuildJob(BuildJob buildJob, Locale locale) {
    Sink sink = getSink();
    sink.tableRow();
    StringBuilder buffer = new StringBuilder();
    if (!StringUtils.isEmpty(buildJob.getName()) && !StringUtils.isEmpty(buildJob.getDescription())) {
        buffer.append(buildJob.getName());
        buffer.append(" : ");
        buffer.append(buildJob.getDescription());
    } else {
        buffer.append(buildJob.getProject());
    }
    sinkCell(sink, buffer.toString());
    // FIXME image
    sinkCell(sink, buildJob.getResult());
    sinkCell(sink, secondsFormat.format(buildJob.getTime()));
    sinkCell(sink, buildJob.getFailureMessage());
    sink.tableRow_();
}
Also used : Sink(org.apache.maven.doxia.sink.Sink)

Example 19 with Sink

use of org.apache.maven.doxia.sink.Sink in project maven-plugins by apache.

the class AnalyzeReportMojo method executeReport.

// Mojo methods -----------------------------------------------------------
/*
     * @see org.apache.maven.plugin.Mojo#execute()
     */
@Override
public void executeReport(Locale locale) throws MavenReportException {
    if (skip) {
        getLog().info("Skipping plugin execution");
        return;
    }
    // Step 0: Checking pom availability
    if ("pom".equals(project.getPackaging())) {
        getLog().info("Skipping pom project");
        return;
    }
    if (outputDirectory == null || !outputDirectory.exists()) {
        getLog().info("Skipping project with no Target directory");
        return;
    }
    // Step 1: Analyze the project
    ProjectDependencyAnalysis analysis;
    try {
        analysis = analyzer.analyze(project);
        if (usedDependencies != null) {
            analysis = analysis.forceDeclaredDependenciesUsage(usedDependencies);
        }
    } catch (ProjectDependencyAnalyzerException exception) {
        throw new MavenReportException("Cannot analyze dependencies", exception);
    }
    // remove everything that's not in the compile scope
    if (ignoreNonCompile) {
        analysis = analysis.ignoreNonCompile();
    }
    // Step 2: Create sink and bundle
    Sink sink = getSink();
    ResourceBundle bundle = getBundle(locale);
    // Step 3: Generate the report
    AnalyzeReportView analyzethis = new AnalyzeReportView();
    analyzethis.generateReport(analysis, sink, bundle);
}
Also used : ProjectDependencyAnalysis(org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis) ProjectDependencyAnalyzerException(org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException) Sink(org.apache.maven.doxia.sink.Sink) ResourceBundle(java.util.ResourceBundle) MavenReportException(org.apache.maven.reporting.MavenReportException)

Aggregations

Sink (org.apache.maven.doxia.sink.Sink)19 MavenReportException (org.apache.maven.reporting.MavenReportException)5 ResourceBundle (java.util.ResourceBundle)4 File (java.io.File)3 IOException (java.io.IOException)3 BuildJob (org.apache.maven.plugins.invoker.model.BuildJob)2 ProjectDependencyAnalysis (org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis)2 ProjectDependencyAnalyzerException (org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException)2 HelpMessage (com.lexicalscope.jewel.cli.HelpMessage)1 OptionHelpMessage (com.lexicalscope.jewel.cli.OptionHelpMessage)1 StringWriter (java.io.StringWriter)1 URLClassLoader (java.net.URLClassLoader)1 DecimalFormat (java.text.DecimalFormat)1 DecimalFormatSymbols (java.text.DecimalFormatSymbols)1 ArrayList (java.util.ArrayList)1 IndexingSink (org.apache.maven.doxia.index.IndexingSink)1 XdocSink (org.apache.maven.doxia.module.xdoc.XdocSink)1 XdocSinkFactory (org.apache.maven.doxia.module.xdoc.XdocSinkFactory)1 SinkAdapter (org.apache.maven.doxia.sink.SinkAdapter)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1