You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2016/02/06 21:56:07 UTC

svn commit: r1728881 - in /maven/plugins/trunk/maven-site-plugin/src: it/MSITE-723/ it/MSITE-723/index.apt it/MSITE-723/invoker.properties it/MSITE-723/pom.xml it/MSITE-723/verify.groovy main/java/org/apache/maven/plugins/site/render/SiteMojo.java

Author: hboutemy
Date: Sat Feb  6 20:56:07 2016
New Revision: 1728881

URL: http://svn.apache.org/viewvc?rev=1728881&view=rev
Log:
[MSITE-723] render generated-site before reports, in case content was generated in pre-site phase

Added:
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/index.apt   (with props)
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/invoker.properties   (with props)
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/pom.xml   (with props)
    maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/verify.groovy   (with props)
Modified:
    maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java

Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/index.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/index.apt?rev=1728881&view=auto
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/index.apt (added)
+++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/index.apt Sat Feb  6 20:56:07 2016
@@ -0,0 +1,20 @@
+Correct!
+
+~~ 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.
+
+  This is an index file in the generated-site.

Propchange: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/index.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/index.apt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/invoker.properties?rev=1728881&view=auto
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/invoker.properties (added)
+++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/invoker.properties Sat Feb  6 20:56:07 2016
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals=clean site

Propchange: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/invoker.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/pom.xml?rev=1728881&view=auto
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/pom.xml (added)
+++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/pom.xml Sat Feb  6 20:56:07 2016
@@ -0,0 +1,87 @@
+<?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>maven-site-index-test</groupId>
+  <artifactId>MSITE-723</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <name>Maven site index test</name>
+  <description>
+    index.apt file generated to target/generated-site in pre-site phase must be rendered
+    instead of MPIR report
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.7</version>
+        <executions>
+          <execution>
+            <id>copy-site-files</id>
+            <phase>pre-site</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <target>
+                <copy failonerror="false" file="index.apt" tofile="${project.build.directory}/generated-site/apt/index.apt"/>
+              </target>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <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>2.5.1</version>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>index</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

Propchange: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/verify.groovy?rev=1728881&view=auto
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/verify.groovy (added)
+++ maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/verify.groovy Sat Feb  6 20:56:07 2016
@@ -0,0 +1,25 @@
+
+/*
+ * 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.
+ */
+
+content = new File( basedir, 'target/site/index.html' ).text;
+
+assert content.contains( 'Correct!' );
+
+return true;
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/verify.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-site-plugin/src/it/MSITE-723/verify.groovy
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java?rev=1728881&r1=1728880&r2=1728881&view=diff
==============================================================================
--- maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java (original)
+++ maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/render/SiteMojo.java Sat Feb  6 20:56:07 2016
@@ -149,6 +149,8 @@ public class SiteMojo
         throws IOException, RendererException, MojoFailureException, MojoExecutionException
     {
         SiteRenderingContext context = createSiteRenderingContext( locale );
+        // MSITE-723 add generated site directory, in case some content has been put in pre-site phase
+        context.addSiteDirectory( generatedSiteDirectory );
 
         context.setInputEncoding( getInputEncoding() );
         context.setOutputEncoding( getOutputEncoding() );
@@ -186,7 +188,7 @@ public class SiteMojo
                     .generate( context.getDecoration(), generatedSiteDirectory, locale );
         }
 
-        // 3. Generated docs must be done afterwards as they are often generated by reports
+        // 3. Generated docs must be (re-)done afterwards as they are often generated by reports
         context.getSiteDirectories().clear();
         context.addSiteDirectory( generatedSiteDirectory );