You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/12/05 21:42:28 UTC

[maven-reporting-impl] 01/01: Use src/site/site.xml

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 1b61e9824bc9c6ec336bba18658da29c4a4780b4
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Mon Dec 5 22:42:16 2022 +0100

    Use src/site/site.xml
---
 .../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>
-     * &lt;skin&gt;
-     *   &lt;groupId&gt;org.apache.maven.skins&lt;/groupId&gt;
-     *   &lt;artifactId&gt;maven-fluido-skin&lt;/artifactId&gt;
-     *   &lt;version&gt;1.11.1&lt;/version&gt;
-     * &lt;/skin&gt;
-     * </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
      *