[MSHARED-333] display what phase or goal is forked by a report

git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1593705 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/it/forked-lifecycle/invoker.properties b/src/it/forked-lifecycle/invoker.properties
new file mode 100644
index 0000000..d179b3f
--- /dev/null
+++ b/src/it/forked-lifecycle/invoker.properties
@@ -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 = site
diff --git a/src/it/forked-lifecycle/pom.xml b/src/it/forked-lifecycle/pom.xml
new file mode 100644
index 0000000..fabd0e8
--- /dev/null
+++ b/src/it/forked-lifecycle/pom.xml
@@ -0,0 +1,77 @@
+<?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>
+  <parent>
+    <groupId>org.apache.maven</groupId>
+    <artifactId>maven-parent</artifactId>
+    <version>21</version>
+  </parent>
+
+  <groupId>org.apache.maven.shared.maven-reporting-exec.its</groupId>
+  <artifactId>forked-lifecycle</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <name>Forked lifecycle test</name>
+  <url>http://maven.apache.org</url>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-site-plugin</artifactId>
+        <version>3.3</version>
+        <dependencies>
+          <dependency>
+            <groupId>@project.groupId@</groupId>
+            <artifactId>@project.artifactId@</artifactId>
+            <version>@project.version@</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+    </plugins>
+  </build>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <version>2.7</version>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>index</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <version>2.9.1</version>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>
diff --git a/src/it/forked-lifecycle/src/main/java/it/Test.java b/src/it/forked-lifecycle/src/main/java/it/Test.java
new file mode 100644
index 0000000..d4f12c9
--- /dev/null
+++ b/src/it/forked-lifecycle/src/main/java/it/Test.java
@@ -0,0 +1,28 @@
+package it;
+
+/*
+ * 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.
+ */
+
+public class Test
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World." );
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/reporting/exec/DefaultMavenReportExecutor.java b/src/main/java/org/apache/maven/reporting/exec/DefaultMavenReportExecutor.java
index 11eb65a..1820749 100644
--- a/src/main/java/org/apache/maven/reporting/exec/DefaultMavenReportExecutor.java
+++ b/src/main/java/org/apache/maven/reporting/exec/DefaultMavenReportExecutor.java
@@ -267,6 +267,21 @@
 
             if ( !mojoExecution.getForkedExecutions().isEmpty() )
             {
+                String msg = report.getGoal() + " report requires ";
+                if ( StringUtils.isNotEmpty( mojoDescriptor.getExecutePhase() ) )
+                {
+                    // forked phase
+                    String lifecycleId =
+                        StringUtils.isEmpty( mojoDescriptor.getExecuteLifecycle() ) ? ""
+                                        : ( '[' + mojoDescriptor.getExecuteLifecycle() + ']' );
+                    logger.info( msg + lifecycleId + mojoDescriptor.getExecutePhase() + " forked phase execution" );
+                }
+                else
+                {
+                    // forked goal
+                    logger.info( msg + mojoDescriptor.getExecuteGoal() + "forked goal execution" );
+                }
+
                 lifecycleExecutor.executeForkedExecutions( mojoExecution, mavenReportExecutorRequest.getMavenSession() );
             }