Skip to content

Commit

Permalink
[MINVOKER-315] Upgrade Maven Reporting API to 3.1.1/Maven Reporting I…
Browse files Browse the repository at this point in the history
…mpl to 3.2.0

This closes #155
  • Loading branch information
michael-o committed Dec 14, 2022
1 parent bf51507 commit b99f3c1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 38 deletions.
32 changes: 31 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,23 @@ under the License.
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings-builder</artifactId>
<version>${mavenVersion}</version>
<scope>provided</scope>
</dependency>

<!-- shared -->
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
<version>3.1.0</version>
<version>3.2.0</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
Expand All @@ -156,6 +168,13 @@ under the License.
</exclusions>
</dependency>

<!-- doxia -->
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sink-api</artifactId>
<version>1.11.1</version>
</dependency>

<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
Expand Down Expand Up @@ -213,6 +232,17 @@ under the License.
<artifactId>plexus-interpolation</artifactId>
<version>1.26</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-i18n</artifactId>
<version>1.0-beta-10</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
Expand Down
43 changes: 6 additions & 37 deletions src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@
import java.util.Locale;

import org.apache.maven.doxia.sink.Sink;
import org.apache.maven.doxia.siterenderer.Renderer;
import org.apache.maven.plugins.invoker.model.BuildJob;
import org.apache.maven.plugins.invoker.model.io.xpp3.BuildJobXpp3Reader;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.AbstractMavenReport;
import org.apache.maven.reporting.MavenReportException;
import org.codehaus.plexus.i18n.I18N;
Expand All @@ -58,32 +56,12 @@ public class InvokerReport
extends AbstractMavenReport
{

/**
* The Maven Project.
*/
@Parameter( defaultValue = "${project}", readonly = true, required = true )
protected MavenProject project;

/**
* Doxia Site Renderer component.
*/
@Component
protected Renderer siteRenderer;

/**
* Internationalization component.
*/
@Component
protected I18N i18n;

/**
* The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from
* the command line. If the goal is run indirectly as part of a site generation, the output directory configured in
* the Maven Site Plugin is used instead.
*/
@Parameter( defaultValue = "${project.reporting.outputDirectory}", required = true )
protected File outputDirectory;

/**
* Base directory where all build reports have been written to.
*/
Expand Down Expand Up @@ -185,6 +163,7 @@ protected void executeReport( Locale locale )

// detail tests table header
sink.table();
sink.tableRows( null, false );

sink.tableRow();
// -------------------------------------------
Expand All @@ -202,6 +181,7 @@ protected void executeReport( Locale locale )
renderBuildJob( buildJob );
}

sink.tableRows_();
sink.table_();

sink.body_();
Expand All @@ -228,6 +208,8 @@ private void constructSummarySection( List<? extends BuildJob> buildJobs, Locale
// ------------------------------------------------------------------------

sink.table();
sink.tableRows( null, false );

sink.tableRow();

sinkTableHeader( sink, getText( locale, "report.invoker.summary.number" ) );
Expand Down Expand Up @@ -283,6 +265,8 @@ else if ( BuildJob.Result.SKIPPED.equals( buildJob.getResult() ) )
sinkCell( sink, secondsFormat.format( totalTime / number ) );

sink.tableRow_();

sink.tableRows_();
sink.table_();

}
Expand Down Expand Up @@ -337,21 +321,6 @@ private String getFormattedName( String name, String description )
return nameAndDescriptionFormat.format( new Object[] { name, description } );
}

protected String getOutputDirectory()
{
return outputDirectory.getAbsolutePath();
}

protected MavenProject getProject()
{
return project;
}

protected Renderer getSiteRenderer()
{
return siteRenderer;
}

public String getDescription( Locale locale )
{
return getText( locale, "report.invoker.result.description" );
Expand Down

0 comments on commit b99f3c1

Please sign in to comment.