This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch use-site.xml in repository https://gitbox.apache.org/repos/asf/maven-reporting-impl.git
commit ec24dc86c060b4045684aeafc7c3f5da7ed7a00e Author: Michael Osipov <micha...@apache.org> AuthorDate: Mon Dec 5 22:42:16 2022 +0100 [MSHARED-480] Use maven-site-plugin's site.xml to use site's skin instead of default when run as mojo This closes #15 --- .../maven/reporting/AbstractMavenReport.java | 53 ++++++---------------- 1 file changed, 13 insertions(+), 40 deletions(-) diff --git a/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java b/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java index d3541ae..b55e8d2 100644 --- a/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java +++ b/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java @@ -24,7 +24,6 @@ import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.doxia.sink.SinkFactory; import org.apache.maven.doxia.site.decoration.DecorationModel; -import org.apache.maven.doxia.site.decoration.Skin; import org.apache.maven.doxia.siterenderer.Renderer; import org.apache.maven.doxia.siterenderer.RendererException; import org.apache.maven.doxia.siterenderer.RenderingContext; @@ -86,6 +85,12 @@ public abstract class AbstractMavenReport @Parameter( defaultValue = "${project}", readonly = true, required = true ) protected MavenProject project; + /** + * The reactor projects. + */ + @Parameter( defaultValue = "${reactorProjects}", required = true, readonly = true ) + protected List<MavenProject> reactorProjects; + /** * Specifies the input encoding. */ @@ -111,21 +116,10 @@ public abstract class AbstractMavenReport protected List<ArtifactRepository> remoteRepositories; /** - * The skin to use when the report generation is invoked directly as a standalone Mojo. - * <p> - * <b>Default value is</b>: - * <pre> - * <skin> - * <groupId>org.apache.maven.skins</groupId> - * <artifactId>maven-fluido-skin</artifactId> - * <version>1.11.1</version> - * </skin> - * </pre> - * - * @see Skin + * Directory containing the <code>site.xml</code> file. */ - @Parameter - protected Skin skin; + @Parameter( defaultValue = "${basedir}/src/site" ) + protected File siteDirectory; /** * The locale to use when the report generation is invoked directly as a standalone Mojo. @@ -210,7 +204,7 @@ public abstract class AbstractMavenReport // copy generated resources also getSiteRenderer().copyResources( siteContext, outputDirectory ); } - catch ( RendererException | IOException | MavenReportException e ) + catch ( RendererException | IOException | MavenReportException | SiteToolException e ) { throw new MojoExecutionException( "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation.", e ); @@ -218,10 +212,10 @@ public abstract class AbstractMavenReport } private SiteRenderingContext createSiteRenderingContext( Locale locale ) - throws MavenReportException, IOException + throws MavenReportException, IOException, SiteToolException { - DecorationModel decorationModel = new DecorationModel(); - decorationModel.setSkin( getSkin() ); + DecorationModel decorationModel = siteTool.getDecorationModel( + siteDirectory, locale, project, reactorProjects, localRepository, remoteRepositories ); Map<String, Object> templateProperties = new HashMap<>(); // We tell the skin that we are rendering in standalone mode @@ -368,27 +362,6 @@ public abstract class AbstractMavenReport return ( outputEncoding == null ) ? WriterFactory.UTF_8 : outputEncoding; } - /** - * Gets the skin - * - * @return the skin for this standalone report - */ - protected Skin getSkin() - { - if ( skin == null ) - { - Skin skin = new Skin(); - skin.setGroupId( "org.apache.maven.skins" ); - skin.setArtifactId( "maven-fluido-skin" ); - skin.setVersion( "1.11.1" ); - return skin; - } - else - { - return skin; - } - } - /** * Gets the locale *