You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2010/09/17 23:26:41 UTC

svn commit: r998334 - in /maven/plugins/branches/maven-site-plugin-3.x: ./ src/it/MSITE-504/ src/it/MSITE-504/maven-plugin-consumer/ src/it/MSITE-504/maven-plugin/ src/it/MSITE-504/maven-plugin/src/ src/it/MSITE-504/maven-plugin/src/main/ src/it/MSITE-...

Author: olamy
Date: Fri Sep 17 21:26:40 2010
New Revision: 998334

URL: http://svn.apache.org/viewvc?rev=998334&view=rev
Log:
[MSITE-504] Maven site fails to run due to non-report goals
Submitted by Marvin Froeder.
Small changes on the patch.

Added:
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/invoker.properties   (with props)
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin-consumer/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin-consumer/pom.xml   (with props)
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/pom.xml   (with props)
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/src/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/src/main/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/src/main/java/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/src/main/java/msite504/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/src/main/java/msite504/mavenplugin/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/src/main/java/msite504/mavenplugin/MyMojo.java   (with props)
    maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/pom.xml   (with props)
Modified:
    maven/plugins/branches/maven-site-plugin-3.x/pom.xml
    maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java

Modified: maven/plugins/branches/maven-site-plugin-3.x/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/pom.xml?rev=998334&r1=998333&r2=998334&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/pom.xml (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/pom.xml Fri Sep 17 21:26:40 2010
@@ -145,6 +145,13 @@ under the License.
         <role>Lithuanian translator</role>
       </roles>
     </contributor>
+    <contributor>
+      <name>Marvin Froeder</name>
+      <email>velo.br@gmail.com</email>
+      <roles>
+        <role>msite-504</role>
+      </roles>
+    </contributor>
   </contributors>
 
   <prerequisites>

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/invoker.properties?rev=998334&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/invoker.properties (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/invoker.properties Fri Sep 17 21:26:40 2010
@@ -0,0 +1 @@
+invoker.goals=install site
\ No newline at end of file

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin-consumer/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin-consumer/pom.xml?rev=998334&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin-consumer/pom.xml (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin-consumer/pom.xml Fri Sep 17 21:26:40 2010
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>msite-504</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <artifactId>maven-plugin-consumer</artifactId>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>msite-504</groupId>
+        <artifactId>maven-plugin</artifactId>
+        <version>1.0</version>
+      </plugin>
+    </plugins>
+  </reporting>
+
+</project>
\ No newline at end of file

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin-consumer/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin-consumer/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/pom.xml?rev=998334&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/pom.xml (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/pom.xml Fri Sep 17 21:26:40 2010
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>msite-504</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+
+  <artifactId>maven-plugin</artifactId>
+
+  <packaging>maven-plugin</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>3.0-beta-3</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/src/main/java/msite504/mavenplugin/MyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/src/main/java/msite504/mavenplugin/MyMojo.java?rev=998334&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/src/main/java/msite504/mavenplugin/MyMojo.java (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/src/main/java/msite504/mavenplugin/MyMojo.java Fri Sep 17 21:26:40 2010
@@ -0,0 +1,48 @@
+package msite504.mavenplugin;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * Goal which touches a timestamp file.
+ * 
+ * @goal touch
+ * @phase process-sources
+ */
+public class MyMojo
+    extends AbstractMojo
+{
+    /**
+     * Location of the file.
+     * 
+     * @parameter
+     * @required
+     */
+    private File outputDirectory;
+
+    public void execute()
+        throws MojoExecutionException
+    {
+        // do nothing
+    }
+}

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/src/main/java/msite504/mavenplugin/MyMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/maven-plugin/src/main/java/msite504/mavenplugin/MyMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/pom.xml?rev=998334&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/pom.xml (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/pom.xml Fri Sep 17 21:26:40 2010
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>msite-504</groupId>
+  <artifactId>parent</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module>maven-plugin</module>
+    <module>maven-plugin-consumer</module>
+  </modules>
+
+  <prerequisites>
+    <maven>3.0</maven>
+  </prerequisites>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-site-plugin</artifactId>
+          <version>@project.version@</version>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-project-info-reports-plugin</artifactId>
+          <version>@projectInfoReportsPluginVersion@</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+</project>
\ No newline at end of file

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/MSITE-504/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java?rev=998334&r1=998333&r2=998334&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java Fri Sep 17 21:26:40 2010
@@ -291,15 +291,15 @@ public class DefaultMavenReportExecutor
     {
         try
         {
-            Mojo mojo = mavenPluginManager.getConfiguredMojo( Mojo.class,
-                                                              mavenReportExecutorRequest.getMavenSession(),
-                                                              mojoExecution );
-
-            if ( !isMavenReport( mojoExecution, pluginDescriptor, mojo ) )
+            if ( !isMavenReport( mojoExecution, pluginDescriptor ) )
             {
                 return null;
             }
 
+            Mojo mojo = mavenPluginManager.getConfiguredMojo( Mojo.class,
+                                                              mavenReportExecutorRequest.getMavenSession(),
+                                                              mojoExecution );
+            
             return (MavenReport) mojo;
         }
         catch ( ClassCastException e )
@@ -328,15 +328,33 @@ public class DefaultMavenReportExecutor
         }
     }
 
-    private boolean isMavenReport( MojoExecution mojoExecution, PluginDescriptor pluginDescriptor, Mojo mojo )
+    private boolean isMavenReport( MojoExecution mojoExecution, PluginDescriptor pluginDescriptor )
     {
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
+        Class<?> mojoClass;
+        Thread.currentThread().setContextClassLoader( mojoExecution.getMojoDescriptor().getRealm() );
+        try
+        {
+            mojoClass =
+                pluginDescriptor.getClassRealm().loadClass( mojoExecution.getMojoDescriptor().getImplementation() );
+        }
+        catch ( ClassNotFoundException e )
+        {
+            getLog().warn( "skip ClassNotFoundException mojoExecution.goal : " + mojoExecution.getGoal() + " : "
+                               + e.getMessage(), e );
+            return false;
+        }
+        finally
+        {
+            Thread.currentThread().setContextClassLoader( originalClassLoader );
+        }       
+
         try
         {
+            Thread.currentThread().setContextClassLoader( mojoExecution.getMojoDescriptor().getRealm() );
             MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( mojoExecution.getGoal() );
-            Thread.currentThread().setContextClassLoader( mojoDescriptor.getRealm() );
 
-            boolean isMavenReport = MavenReport.class.isAssignableFrom( mojo.getClass() );
+            boolean isMavenReport = MavenReport.class.isAssignableFrom( mojoClass );
 
             if ( getLog().isDebugEnabled() )
             {