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/08/06 21:48:04 UTC

[maven-reporting-impl] branch maven-reporting-impl-3.x created (now ecf1b03)

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a change to branch maven-reporting-impl-3.x
in repository https://gitbox.apache.org/repos/asf/maven-reporting-impl.git


      at ecf1b03  [MSHARED-1099] Render with a skin when report is run in standalone mode

This branch includes the following new commits:

     new ae6a6d1  [MSHARED-1120] Upgrade Maven Reporting API to 3.1.1
     new df5e068  [MSHARED-1121] Upgrade plugins and components in project and ITs
     new ecf1b03  [MSHARED-1099] Render with a skin when report is run in standalone mode

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-reporting-impl] 02/03: [MSHARED-1121] Upgrade plugins and components in project and ITs

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch maven-reporting-impl-3.x
in repository https://gitbox.apache.org/repos/asf/maven-reporting-impl.git

commit df5e068b2db2945d3c8906fbb2e5bd01864c0e50
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Aug 6 23:17:51 2022 +0200

    [MSHARED-1121] Upgrade plugins and components in project and ITs
---
 pom.xml                               |  6 +++---
 src/it/setup-reporting-plugin/pom.xml | 11 ++++-------
 src/it/use-as-site-report/pom.xml     |  4 ++--
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/pom.xml b/pom.xml
index 404b78f..f07f637 100644
--- a/pom.xml
+++ b/pom.xml
@@ -97,7 +97,7 @@
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-shared-utils</artifactId>
-      <version>3.3.3</version>
+      <version>3.3.4</version>
     </dependency>
 
     <!-- Doxia -->
@@ -131,14 +131,14 @@
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
-      <version>3.0.24</version>
+      <version>3.3.1</version>
     </dependency>
 
     <!-- test -->
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>4.13.1</version>
+      <version>4.13.2</version>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/src/it/setup-reporting-plugin/pom.xml b/src/it/setup-reporting-plugin/pom.xml
index a3ff962..3b3b5ce 100644
--- a/src/it/setup-reporting-plugin/pom.xml
+++ b/src/it/setup-reporting-plugin/pom.xml
@@ -53,19 +53,19 @@ under the License.
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-plugin-api</artifactId>
-      <version>3.0.5</version>
+      <version>@mavenVersion@</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.plugin-tools</groupId>
       <artifactId>maven-plugin-annotations</artifactId>
-      <version>3.3</version>
+      <version>3.6.4</version>
       <scope>provided</scope>
     </dependency>
 
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-shared-utils</artifactId>
-      <version>0.7</version>
+      <version>3.3.4</version>
     </dependency>
   </dependencies>
 
@@ -82,7 +82,7 @@ under the License.
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-plugin-plugin</artifactId>
-        <version>3.3</version>
+        <version>3.6.4</version>
         <executions>
           <execution>
             <id>default-descriptor</id>
@@ -93,9 +93,6 @@ under the License.
             <goals>
               <goal>helpmojo</goal>
             </goals>
-            <configuration><!-- TODO: remove when upgrading plugin-tools to 3.4: see MPLUGIN-238 -->
-              <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
-            </configuration>
           </execution>
         </executions>
       </plugin>
diff --git a/src/it/use-as-site-report/pom.xml b/src/it/use-as-site-report/pom.xml
index 5371d0f..47a3863 100644
--- a/src/it/use-as-site-report/pom.xml
+++ b/src/it/use-as-site-report/pom.xml
@@ -37,7 +37,7 @@ under the License.
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-site-plugin</artifactId>
-        <version>3.10.0</version>
+        <version>3.11.0</version>
       </plugin>
     </plugins>
   </build>
@@ -47,7 +47,7 @@ under the License.
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-project-info-reports-plugin</artifactId>
-        <version>3.2.1</version>
+        <version>3.4.0</version>
         <reportSets>
           <reportSet>
             <reports>


[maven-reporting-impl] 03/03: [MSHARED-1099] Render with a skin when report is run in standalone mode

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch maven-reporting-impl-3.x
in repository https://gitbox.apache.org/repos/asf/maven-reporting-impl.git

commit ecf1b039a76a1b6eeda5e79e0885599e9e573cc8
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Aug 6 23:46:02 2022 +0200

    [MSHARED-1099] Render with a skin when report is run in standalone mode
---
 pom.xml                                            | 10 +++
 .../maven/reporting/AbstractMavenReport.java       | 90 +++++++++++++++++-----
 2 files changed, 81 insertions(+), 19 deletions(-)

diff --git a/pom.xml b/pom.xml
index f07f637..1d97cfc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,6 +89,11 @@
       <artifactId>maven-core</artifactId>
       <version>${mavenVersion}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>${mavenVersion}</version>
+    </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-plugin-api</artifactId>
@@ -116,6 +121,11 @@
       <artifactId>doxia-core</artifactId>
       <version>${doxiaVersion}</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.doxia</groupId>
+      <artifactId>doxia-integration-tools</artifactId>
+      <version>${doxiaSitetoolsVersion}</version>
+    </dependency>
     <dependency>
       <groupId>org.apache.maven.doxia</groupId>
       <artifactId>doxia-site-renderer</artifactId>
diff --git a/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java b/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java
index cdb9a0b..e205d27 100644
--- a/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java
+++ b/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java
@@ -19,6 +19,8 @@ package org.apache.maven.reporting;
  * under the License.
  */
 
+import org.apache.maven.artifact.Artifact;
+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;
@@ -27,6 +29,8 @@ import org.apache.maven.doxia.siterenderer.RendererException;
 import org.apache.maven.doxia.siterenderer.RenderingContext;
 import org.apache.maven.doxia.siterenderer.SiteRenderingContext;
 import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
+import org.apache.maven.doxia.tools.SiteTool;
+import org.apache.maven.doxia.tools.SiteToolException;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.Component;
@@ -35,12 +39,15 @@ import org.apache.maven.project.MavenProject;
 import org.apache.maven.shared.utils.WriterFactory;
 import org.codehaus.plexus.util.ReaderFactory;
 
+import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 
@@ -90,6 +97,24 @@ public abstract class AbstractMavenReport
     @Parameter( property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}", readonly = true )
     private String outputEncoding;
 
+    /**
+     * The local repository.
+     */
+    @Parameter( defaultValue = "${localRepository}", readonly = true, required = true )
+    protected ArtifactRepository localRepository;
+
+    /**
+     * Remote repositories used for the project.
+     */
+    @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true )
+    protected List<ArtifactRepository> remoteRepositories;
+
+    /**
+     * SiteTool.
+     */
+    @Component
+    protected SiteTool siteTool;
+
     /**
      * Doxia Site Renderer component.
      */
@@ -126,19 +151,17 @@ public abstract class AbstractMavenReport
 
         Locale locale = Locale.getDefault();
 
-        SiteRenderingContext siteContext = new SiteRenderingContext();
-        siteContext.setDecoration( new DecorationModel() );
-        siteContext.setTemplateName( "org/apache/maven/doxia/siterenderer/resources/default-site.vm" );
-        siteContext.setLocale( locale );
-        siteContext.setTemplateProperties( getTemplateProperties() );
+        try
+        {
+            SiteRenderingContext siteContext = createSiteRenderingContext( locale );
 
-        // TODO Replace null with real value
-        RenderingContext context = new RenderingContext( outputDirectory, filename, null );
+            // copy resources
+            getSiteRenderer().copyResources( siteContext, outputDirectory );
 
-        SiteRendererSink sink = new SiteRendererSink( context );
+            // TODO Replace null with real value
+            RenderingContext docRenderingContext = new RenderingContext( outputDirectory, filename, null );
 
-        try
-        {
+            SiteRendererSink sink = new SiteRendererSink( docRenderingContext );
 
             generate( sink, null, locale );
 
@@ -147,12 +170,16 @@ public abstract class AbstractMavenReport
                 outputDirectory.mkdirs();
 
                 try ( Writer writer =
-                    new OutputStreamWriter( new FileOutputStream( new File( outputDirectory, filename ) ),
-                                            getOutputEncoding() ) )
+                      new OutputStreamWriter( new FileOutputStream( new File( outputDirectory, filename ) ),
+                                              getOutputEncoding() ) )
                 {
+                    // render report
                     getSiteRenderer().mergeDocumentIntoSite( writer, sink, siteContext );
                 }
             }
+
+            // copy generated resources also
+            getSiteRenderer().copyResources( siteContext, outputDirectory );
         }
         catch ( RendererException | IOException | MavenReportException e )
         {
@@ -161,14 +188,14 @@ public abstract class AbstractMavenReport
         }
     }
 
-    /**
-     * create template properties like done in maven-site-plugin's
-     * <code>AbstractSiteRenderingMojo.createSiteRenderingContext( Locale )</code>
-     * @return properties
-     */
-    private Map<String, Object> getTemplateProperties()
+    private SiteRenderingContext createSiteRenderingContext( Locale locale )
+        throws MavenReportException, IOException
     {
+        DecorationModel decorationModel = new DecorationModel();
+
         Map<String, Object> templateProperties = new HashMap<>();
+        // We tell the skin that we are rendering in standalone mode
+        templateProperties.put( "standalone", Boolean.TRUE );
         templateProperties.put( "project", getProject() );
         templateProperties.put( "inputEncoding", getInputEncoding() );
         templateProperties.put( "outputEncoding", getOutputEncoding() );
@@ -177,7 +204,32 @@ public abstract class AbstractMavenReport
         {
             templateProperties.put( (String) entry.getKey(), entry.getValue() );
         }
-        return templateProperties;
+
+        SiteRenderingContext context;
+        try
+        {
+           Artifact skinArtifact =
+               siteTool.getSkinArtifactFromRepository( localRepository, remoteRepositories, decorationModel );
+
+           getLog().info( buffer().a( "Rendering content with " ).strong( skinArtifact.getId()
+               + " skin" ).a( '.' ).toString() );
+
+            context = siteRenderer.createContextForSkin( skinArtifact, templateProperties, decorationModel,
+                                                         project.getName(), locale );
+        }
+        catch ( SiteToolException e )
+        {
+            throw new MavenReportException( "Failed to retrieve skin artifact", e );
+        }
+        catch ( RendererException e )
+        {
+            throw new MavenReportException( "Failed to create context for skin", e );
+        }
+
+        // Generate static site
+        context.setRootDirectory( project.getBasedir() );
+
+        return context;
     }
 
     /**


[maven-reporting-impl] 01/03: [MSHARED-1120] Upgrade Maven Reporting API to 3.1.1

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch maven-reporting-impl-3.x
in repository https://gitbox.apache.org/repos/asf/maven-reporting-impl.git

commit ae6a6d127b1a405bfb571811c47b9e30eb2eb5ed
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Aug 6 23:11:16 2022 +0200

    [MSHARED-1120] Upgrade Maven Reporting API to 3.1.1
---
 pom.xml                                                           | 5 +++--
 src/it/setup-reporting-plugin/pom.xml                             | 2 +-
 src/main/java/org/apache/maven/reporting/AbstractMavenReport.java | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 007a116..404b78f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,10 +68,11 @@
   </distributionManagement>
 
   <properties>
+    <javaVersion>7</javaVersion>
     <mavenVersion>3.1.0</mavenVersion>
     <doxiaVersion>1.11.1</doxiaVersion>
     <doxiaSitetoolsVersion>1.11.1</doxiaSitetoolsVersion>
-    <javaVersion>7</javaVersion>
+    <reportingApiVersion>3.1.1</reportingApiVersion>
     <project.build.outputTimestamp>2022-02-05T21:36:19Z</project.build.outputTimestamp>
   </properties>
 
@@ -79,7 +80,7 @@
     <dependency>
       <groupId>org.apache.maven.reporting</groupId>
       <artifactId>maven-reporting-api</artifactId>
-      <version>3.1.0</version>
+      <version>${reportingApiVersion}</version>
     </dependency>
 
     <!-- Maven -->
diff --git a/src/it/setup-reporting-plugin/pom.xml b/src/it/setup-reporting-plugin/pom.xml
index c7a3191..a3ff962 100644
--- a/src/it/setup-reporting-plugin/pom.xml
+++ b/src/it/setup-reporting-plugin/pom.xml
@@ -46,7 +46,7 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.reporting</groupId>
       <artifactId>maven-reporting-api</artifactId>
-      <version>3.1.0</version>
+      <version>@reportingApiVersion@</version>
     </dependency>
 
     <!-- plugin API and plugin-tools -->
diff --git a/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java b/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java
index e1279e8..cdb9a0b 100644
--- a/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java
+++ b/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java
@@ -189,6 +189,7 @@ public abstract class AbstractMavenReport
      * @deprecated use {@link #generate(Sink, SinkFactory, Locale)} instead.
      */
     @Deprecated
+    @Override
     public void generate( org.codehaus.doxia.sink.Sink sink, Locale locale )
         throws MavenReportException
     {
@@ -204,7 +205,6 @@ public abstract class AbstractMavenReport
      * @deprecated use {@link #generate(Sink, SinkFactory, Locale)} instead.
      */
     @Deprecated
-    @Override
     public void generate( Sink sink, Locale locale )
         throws MavenReportException
     {