maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r905460 - in /maven/plugins/branches/maven-site-plugin-3.x/src: it/it-plugin-test/ it/it-plugin-test/src/ it/it-plugin-test/src/main/ it/it-plugin-test/src/main/java/ it/it-plugin-test/src/main/java/org/ it/it-plugin-test/src/main/java/org/...
Date Mon, 01 Feb 2010 23:36:50 GMT
Author: olamy
Date: Mon Feb  1 23:36:50 2010
New Revision: 905460

URL: http://svn.apache.org/viewvc?rev=905460&view=rev
Log:
[MSITE-460] error when using Maven 3.x with maven-site-plugin 3.x for mojo using org/apache/maven/plugin/registry/PluginRegistry.

ignore CNFE with this class.

Added:
    maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/pom.xml
    maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/java/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/java/org/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/java/org/apache/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/java/org/apache/maven/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/java/org/apache/maven/plugins/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/java/org/apache/maven/plugins/it/
    maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/java/org/apache/maven/plugins/it/MyMojo.java
  (with props)
Modified:
    maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/pom.xml?rev=905460&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/pom.xml (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/pom.xml Mon Feb  1
23:36:50 2010
@@ -0,0 +1,32 @@
+<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>org.apache.maven.plugins.it</groupId>
+  <artifactId>it-plugin-test</artifactId>
+  <packaging>maven-plugin</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>it-plugin-test Maven Mojo</name>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.2.1</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.2</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+        <version>2.5.1</version>
+      </plugin>    
+    </plugins>
+  </reporting>
+</project>

Added: maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/java/org/apache/maven/plugins/it/MyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/java/org/apache/maven/plugins/it/MyMojo.java?rev=905460&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/java/org/apache/maven/plugins/it/MyMojo.java
(added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/java/org/apache/maven/plugins/it/MyMojo.java
Mon Feb  1 23:36:50 2010
@@ -0,0 +1,81 @@
+package org.apache.maven.plugins.it;
+
+/*
+ * 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 expression="${project.build.directory}"
+     * @required
+     */
+    private File outputDirectory;
+
+    public void execute()
+        throws MojoExecutionException
+    {
+        File f = outputDirectory;
+
+        if ( !f.exists() )
+        {
+            f.mkdirs();
+        }
+
+        File touch = new File( f, "touch.txt" );
+
+        FileWriter w = null;
+        try
+        {
+            w = new FileWriter( touch );
+
+            w.write( "touch.txt" );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Error creating file " + touch, e );
+        }
+        finally
+        {
+            if ( w != null )
+            {
+                try
+                {
+                    w.close();
+                }
+                catch ( IOException e )
+                {
+                    // ignore
+                }
+            }
+        }
+    }
+}

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/java/org/apache/maven/plugins/it/MyMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/src/main/java/org/apache/maven/plugins/it/MyMojo.java
------------------------------------------------------------------------------
    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=905460&r1=905459&r2=905460&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
Mon Feb  1 23:36:50 2010
@@ -54,6 +54,7 @@
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 import org.codehaus.plexus.util.xml.Xpp3DomUtils;
+import org.mortbay.log.Log;
 
 /**
  *  
@@ -276,6 +277,24 @@
             getLog().warn( "skip ClassCastException " + e.getMessage() );
             return null;
         }
+        catch (PluginContainerException e )
+        {
+            /**
+             * ignore old plugin which are using removed PluginRegistry
+             * [INFO] Caused by: java.lang.NoClassDefFoundError: org/apache/maven/plugin/registry/PluginRegistry
+             */
+            if ( e.getCause() != null && e.getCause() instanceof NoClassDefFoundError
&& e.getMessage().contains( "PluginRegistry" ) )
+            {
+                getLog().warn( "skip NoClassDefFoundError with PluginRegistry " );
+                // too noisy only in debug mode + e.getMessage() );
+                if (getLog().isDebugEnabled())
+                {
+                    Log.debug( e.getMessage(), e );
+                }
+                return null;
+            }
+            throw e;
+        }
 
     }
 



Mime
View raw message