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 2023/01/17 20:48:54 UTC

[maven-site-plugin] branch MSITE-921 updated (a060117f -> c2884650)

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

michaelo pushed a change to branch MSITE-921
in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git


    omit a060117f [MSITE-921] Populate SiteRenderingContext#getPublishDate() with ${project.build.outputTimestamp}
     add 79de4820 use non-deprecated method
     add e414d234 [MSITE-920] Remove Maven 2 compat code
     add 21a5b339 [MSITE-220] site:run mojo will not display Javadoc or JXR report results
     new c2884650 [MSITE-921] Populate SiteRenderingContext#getPublishDate() with ${project.build.outputTimestamp}

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (a060117f)
            \
             N -- N -- N   refs/heads/MSITE-921 (c2884650)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 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.


Summary of changes:
 .../plugins/site/deploy/AbstractDeployMojo.java    | 73 ----------------------
 .../site/render/ReportDocumentRenderer.java        | 39 ------------
 .../maven/plugins/site/render/SiteJarMojo.java     |  2 +-
 .../apache/maven/plugins/site/run/DoxiaFilter.java | 20 +++---
 .../apache/maven/plugins/site/run/SiteRunMojo.java |  4 +-
 5 files changed, 16 insertions(+), 122 deletions(-)


[maven-site-plugin] 01/01: [MSITE-921] Populate SiteRenderingContext#getPublishDate() with ${project.build.outputTimestamp}

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

michaelo pushed a commit to branch MSITE-921
in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git

commit c288465016b015fe08e3024718f24037045f2861
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun Jan 15 01:02:51 2023 +0100

    [MSITE-921] Populate SiteRenderingContext#getPublishDate() with ${project.build.outputTimestamp}
    
    This closes #123
---
 src/it/projects/publishDate/pom.xml                | 64 ++++++++++++++++++++++
 src/it/projects/publishDate/verify.groovy          | 24 ++++++++
 .../site/render/AbstractSiteRenderingMojo.java     | 12 ++++
 3 files changed, 100 insertions(+)

diff --git a/src/it/projects/publishDate/pom.xml b/src/it/projects/publishDate/pom.xml
new file mode 100644
index 00000000..ee953711
--- /dev/null
+++ b/src/it/projects/publishDate/pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.site.its</groupId>
+  <artifactId>publishDate</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <name>maven-site-plugin IT: publish date</name>
+  <description>check that publish date is populated from 'project.build.outputTimestamp'</description>
+  <url>http://maven.apache.org</url>
+
+  <properties>
+    <projectInfoReportsPluginVersion>@projectInfoReportsPluginVersion@</projectInfoReportsPluginVersion>
+    <project.build.outputTimestamp>2000-01-01T00:00:00Z</project.build.outputTimestamp>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-site-plugin</artifactId>
+        <version>@project.version@</version>
+      </plugin>
+    </plugins>
+  </build>
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <version>@projectInfoReportsPluginVersion@</version>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>index</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>
diff --git a/src/it/projects/publishDate/verify.groovy b/src/it/projects/publishDate/verify.groovy
new file mode 100644
index 00000000..af6a09b0
--- /dev/null
+++ b/src/it/projects/publishDate/verify.groovy
@@ -0,0 +1,24 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+sitedir = new File( basedir, 'target/site' );
+index = new File( sitedir, 'index.html' );
+assert index.exists();
+assert index.getText().contains( '<li id="publishDate">Last Published: 2000-01-01' );
diff --git a/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java b/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
index 921ac25f..bb02ffe3 100644
--- a/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
+++ b/src/main/java/org/apache/maven/plugins/site/render/AbstractSiteRenderingMojo.java
@@ -19,6 +19,7 @@ package org.apache.maven.plugins.site.render;
  * under the License.
  */
 
+import org.apache.maven.archiver.MavenArchiver;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.doxia.site.decoration.DecorationModel;
 import org.apache.maven.doxia.site.decoration.Menu;
@@ -39,6 +40,7 @@ import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.plugins.site.descriptor.AbstractSiteDescriptorMojo;
+import org.apache.maven.project.MavenProject;
 import org.apache.maven.reporting.MavenReport;
 import org.apache.maven.reporting.exec.MavenReportExecution;
 import org.apache.maven.reporting.exec.MavenReportExecutor;
@@ -50,6 +52,7 @@ import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -313,6 +316,15 @@ public abstract class AbstractSiteRenderingMojo extends AbstractSiteDescriptorMo
                 + e.getMessage(), e );
         }
 
+        // Add publish date
+        MavenProject p = attributes.get( "project" ) != null ? (MavenProject) attributes.get( "project" ) : project;
+        String outputTimestamp = p.getProperties().getProperty( "project.build.outputTimestamp" );
+        MavenArchiver.parseBuildOutputTimestamp( outputTimestamp ).ifPresent( v ->
+            {
+                context.setPublishDate( Date.from( v ) );
+            }
+        );
+
         // Generate static site
         context.setRootDirectory( project.getBasedir() );
         if ( !locale.equals( SiteTool.DEFAULT_LOCALE ) )