Author: jdcasey
Date: Wed Feb 25 16:42:47 2009
New Revision: 747854

URL: http://svn.apache.org/viewvc?rev=747854&view=rev
Log:
[MNG-2690] Adding plugin that triggers various sorts of errors during mojo 
loading and execution. Also adding integration tests for the 
NoClassDefFoundError origins in mojo loading and configuration, and 
ComponentLookupException from the same places.

Added:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2690MojoLoadingErrorsTest.java
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/mojo-complookup/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/mojo-complookup/pom.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-mojo/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-mojo/pom.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-param/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-param/pom.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/requirement-complookup/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/requirement-complookup/pom.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/pom.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoComponentLookupExceptionMojo.java
   (with props)
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoExecutionExceptionMojo.java
   (with props)
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoFailureExceptionMojo.java
   (with props)
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorComponentMojo.java
   (with props)
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorInterfaceMojo.java
   (with props)
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/RequirementComponentLookupExceptionMojo.java
   (with props)
Modified:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/pom.xml
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml

Modified: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=747854&r1=747853&r2=747854&view=diff
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
 (original)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
 Wed Feb 25 16:42:47 2009
@@ -239,6 +239,7 @@
         suite.addTestSuite( MavenITmng2739RequiredRepositoryElementsTest.class 
);
         suite.addTestSuite( MavenITmng2720SiblingClasspathArtifactsTest.class 
);
         suite.addTestSuite( MavenITmng2695OfflinePluginSnapshotsTest.class );
+        suite.addTestSuite( MavenITmng2690MojoLoadingErrorsTest.class );
         suite.addTestSuite( 
MavenITmng2668UsePluginDependenciesForSortingTest.class );
         suite.addTestSuite( MavenITmng2605BogusProfileActivationTest.class );
         suite.addTestSuite( MavenITmng2591MergeInheritedPluginConfigTest.class 
);

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2690MojoLoadingErrorsTest.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2690MojoLoadingErrorsTest.java?rev=747854&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2690MojoLoadingErrorsTest.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2690MojoLoadingErrorsTest.java
 Wed Feb 25 16:42:47 2009
@@ -0,0 +1,231 @@
+package org.apache.maven.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.
+ */
+
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+/**
+ * This is a test set for <a 
href="http://jira.codehaus.org/browse/MNG-2690";>MNG-2690</a>.
+ * 
+ * It checks, at the most basic level possible, that the plugin manager is 
intercepting things like
+ * {...@link NoClassDefFoundError} and ComponntLookupException, then throwing 
user-friendly errors when loading and
+ * configuring a mojo.
+ * 
+ * @author jdcasey
+ */
+public class MavenITmng2690MojoLoadingErrorsTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng2690MojoLoadingErrorsTest()
+    {
+        super( "(2.1.0-M1,)" );
+    }
+
+    public void testNoClassDefFromMojoLoad()
+        throws IOException, VerificationException
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-2690/noclassdef-mojo" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+
+        try
+        {
+            verifier.executeGoal( "validate" );
+
+            fail( "should throw an error during execution." );
+        }
+        catch ( VerificationException e )
+        {
+            // expected...it'd be nice if we could get the specifics of the 
exception right here...
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+
+        List lines = verifier.loadFile( new File( testDir, "log.txt" ), false 
);
+
+        boolean foundMessage = false;
+        boolean foundClass = false;
+        for ( Iterator it = lines.iterator(); it.hasNext(); )
+        {
+            String line = (String) it.next();
+            if ( line.indexOf( "A required class is missing" ) > -1 )
+            {
+                foundMessage = true;
+            }
+
+            // trigger AFTER the required-class message is found, since the 
class name should come afterward.
+            if ( foundMessage && line.replace( '/', '.' ).indexOf( 
TestCase.class.getName() ) > -1 )
+            {
+                foundClass = true;
+                break;
+            }
+        }
+
+        assertTrue( "User-friendly message was not found in output.", 
foundMessage );
+        assertTrue( "Missing class name was not found in output.", foundClass 
);
+    }
+
+    public void testNoClassDefFromMojoConfiguration()
+        throws IOException, VerificationException
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-2690/noclassdef-param" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+
+        try
+        {
+            verifier.executeGoal( "validate" );
+
+            fail( "should throw an error during execution." );
+        }
+        catch ( VerificationException e )
+        {
+            // expected...it'd be nice if we could get the specifics of the 
exception right here...
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+
+        List lines = verifier.loadFile( new File( testDir, "log.txt" ), false 
);
+
+        boolean foundMessage = false;
+        boolean foundClass = false;
+        for ( Iterator it = lines.iterator(); it.hasNext(); )
+        {
+            String line = (String) it.next();
+            if ( line.indexOf( "A required class was missing during mojo 
configuration" ) > -1 )
+            {
+                foundMessage = true;
+            }
+
+            // trigger AFTER the required-class message is found, since the 
class name should come afterward.
+            if ( foundMessage && line.replace( '/', '.' ).indexOf( 
TestCase.class.getName() ) > -1 )
+            {
+                foundClass = true;
+                break;
+            }
+        }
+
+        assertTrue( "User-friendly message was not found in output.", 
foundMessage );
+        assertTrue( "Missing class name was not found in output.", foundClass 
);
+    }
+
+    public void testMojoComponentLookupException()
+        throws IOException, VerificationException
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-2690/mojo-complookup" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+
+        try
+        {
+            verifier.executeGoal( "validate" );
+
+            fail( "should throw an error during execution." );
+        }
+        catch ( VerificationException e )
+        {
+            // expected...it'd be nice if we could get the specifics of the 
exception right here...
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+
+        List lines = verifier.loadFile( new File( testDir, "log.txt" ), false 
);
+
+        String compLookupMessage =
+            "Unable to find the mojo 'mojo-component-lookup-exception' "
+                + "(or one of its required components) in the plugin "
+                + "'org.apache.maven.its.plugins:maven-it-plugin-error";
+
+        boolean foundMessage = false;
+        for ( Iterator it = lines.iterator(); it.hasNext(); )
+        {
+            String line = (String) it.next();
+            if ( line.indexOf( compLookupMessage ) > -1 )
+            {
+                foundMessage = true;
+                break;
+            }
+        }
+
+        assertTrue( "User-friendly message was not found in output.", 
foundMessage );
+    }
+
+    public void testMojoRequirementComponentLookupException()
+        throws IOException, VerificationException
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-2690/requirement-complookup" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+
+        try
+        {
+            verifier.executeGoal( "validate" );
+
+            fail( "should throw an error during execution." );
+        }
+        catch ( VerificationException e )
+        {
+            // expected...it'd be nice if we could get the specifics of the 
exception right here...
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+
+        List lines = verifier.loadFile( new File( testDir, "log.txt" ), false 
);
+
+        String compLookupMessage =
+            "Unable to find the mojo 'requirement-component-lookup-exception' "
+                + "(or one of its required components) in the plugin "
+                + "'org.apache.maven.its.plugins:maven-it-plugin-error";
+
+        boolean foundMessage = false;
+        for ( Iterator it = lines.iterator(); it.hasNext(); )
+        {
+            String line = (String) it.next();
+            if ( line.indexOf( compLookupMessage ) > -1 )
+            {
+                foundMessage = true;
+                break;
+            }
+        }
+
+        assertTrue( "User-friendly message was not found in output.", 
foundMessage );
+    }
+
+}

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2690MojoLoadingErrorsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/pom.xml?rev=747854&r1=747853&r2=747854&view=diff
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/pom.xml
 (original)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/pom.xml
 Wed Feb 25 16:42:47 2009
@@ -149,6 +149,12 @@
     </dependency>
     <dependency>
       <groupId>org.apache.maven.its.plugins</groupId>
+      <artifactId>maven-it-plugin-error</artifactId>
+      <version>${itPluginVersion}</version>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.its.plugins</groupId>
       <artifactId>maven-it-plugin-fork</artifactId>
       <version>${itPluginVersion}</version>
       <scope>runtime</scope>

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/mojo-complookup/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/mojo-complookup/pom.xml?rev=747854&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/mojo-complookup/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/mojo-complookup/pom.xml
 Wed Feb 25 16:42:47 2009
@@ -0,0 +1,27 @@
+<?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>org.apache.maven.its.mng2690</groupId>
+  <artifactId>mng-2690-mojo-complookup</artifactId>
+  <version>1</version>
+  <packaging>pom</packaging>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-error</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <id>trigger-error</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>mojo-component-lookup-exception</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/mojo-complookup/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-mojo/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-mojo/pom.xml?rev=747854&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-mojo/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-mojo/pom.xml
 Wed Feb 25 16:42:47 2009
@@ -0,0 +1,27 @@
+<?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>org.apache.maven.its.mng2690</groupId>
+  <artifactId>mng-2690-noclassdef-mojo</artifactId>
+  <version>1</version>
+  <packaging>pom</packaging>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-error</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <id>trigger-error</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>no-class-def-found-error-mojo</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-mojo/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-param/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-param/pom.xml?rev=747854&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-param/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-param/pom.xml
 Wed Feb 25 16:42:47 2009
@@ -0,0 +1,27 @@
+<?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>org.apache.maven.its.mng2690</groupId>
+  <artifactId>mng-2690-noclassdef-param</artifactId>
+  <version>1</version>
+  <packaging>pom</packaging>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-error</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <id>trigger-error</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>no-class-def-found-error-param</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/noclassdef-param/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/requirement-complookup/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/requirement-complookup/pom.xml?rev=747854&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/requirement-complookup/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/requirement-complookup/pom.xml
 Wed Feb 25 16:42:47 2009
@@ -0,0 +1,27 @@
+<?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>org.apache.maven.its.mng2690</groupId>
+  <artifactId>mng-2690-requirement-complookup</artifactId>
+  <version>1</version>
+  <packaging>pom</packaging>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-error</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <id>trigger-error</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>requirement-component-lookup-exception</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-2690/requirement-complookup/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/pom.xml?rev=747854&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/pom.xml
 Wed Feb 25 16:42:47 2009
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd"; 
xmlns="http://maven.apache.org/POM/4.0.0";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>maven-it-plugins</artifactId>
+    <groupId>org.apache.maven.its.plugins</groupId>
+    <version>2.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>maven-it-plugin-error</artifactId>
+  <packaging>maven-plugin</packaging>
+  
+  <name>Maven Integration Test Plugin :: Error Mojos</name>
+  <description>
+    A test plugin that throws various sorts of errors when loaded or executed. 
This plugin is designed to test Maven's ability
+    to repackage runtime exceptions and other similar errors in a way that 
helps the user.
+  </description>
+  <inceptionYear>2009</inceptionYear>
+
+  <properties>
+    <maven.test.skip>true</maven.test.skip>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.2</version>
+        <configuration>
+          <excludes>
+            
<exclude>**/org/apache/maven/plugin/coreit/MojoComponentLookupExceptionMojo*</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoComponentLookupExceptionMojo.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoComponentLookupExceptionMojo.java?rev=747854&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoComponentLookupExceptionMojo.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoComponentLookupExceptionMojo.java
 Wed Feb 25 16:42:47 2009
@@ -0,0 +1,20 @@
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * @goal mojo-component-lookup-exception
+ * @requiresProject false
+ */
+public class MojoComponentLookupExceptionMojo
+    extends AbstractMojo
+{
+    
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+    }
+
+}

Propchange: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoComponentLookupExceptionMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoExecutionExceptionMojo.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoExecutionExceptionMojo.java?rev=747854&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoExecutionExceptionMojo.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoExecutionExceptionMojo.java
 Wed Feb 25 16:42:47 2009
@@ -0,0 +1,40 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * 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;
+
+/**
+ * @goal mojo-execution-exception
+ * @requiresProject false
+ */
+public class MojoExecutionExceptionMojo
+    extends AbstractMojo
+{
+    /**
+     * @parameter expression="${error.message}" default-value="Planned 
MojoExecutionException."
+     * @required
+     */
+    private String message;
+
+    public void execute()
+        throws MojoExecutionException
+    {
+        throw new MojoExecutionException( message );
+    }
+}

Propchange: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoExecutionExceptionMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoFailureExceptionMojo.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoFailureExceptionMojo.java?rev=747854&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoFailureExceptionMojo.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoFailureExceptionMojo.java
 Wed Feb 25 16:42:47 2009
@@ -0,0 +1,63 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * 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.MojoFailureException;
+
+/**
+ * @goal mojo-failure-exception
+ * @requiresProject false
+ */
+public class MojoFailureExceptionMojo
+    extends AbstractMojo
+{
+    /**
+     * Message used in {...@link 
MojoFailureException#MojoFailureException(String)}, unless longMessage
+     * is supplied; then, this becomes the short message in {...@link 
MojoFailureException#MojoFailureException(Object, String, String)}.
+     * 
+     * @parameter expression="${error.message}" default-value="Planned 
MojoExecutionException."
+     * @required
+     */
+    private String message;
+    
+    /**
+     * If supplied, The form {...@link 
MojoFailureException#MojoFailureException(Object, String, String)} will be used.
+     * 
+     * @parameter expression="${error.longMessage}"
+     * @required
+     */
+    private String longMessage;
+    
+    /**
+     * @parameter expression="${error.source}"
+     */
+    private String source;
+
+    public void execute()
+        throws MojoFailureException
+    {
+        if ( longMessage != null )
+        {
+            throw new MojoFailureException( source, message, longMessage );
+        }
+        else
+        {
+            throw new MojoFailureException( message );
+        }
+    }
+}

Propchange: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/MojoFailureExceptionMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorComponentMojo.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorComponentMojo.java?rev=747854&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorComponentMojo.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorComponentMojo.java
 Wed Feb 25 16:42:47 2009
@@ -0,0 +1,31 @@
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+import junit.framework.TestCase;
+
+/**
+ * Takes a parameter with a class from a provided-scope dependency, so that 
the mojo class itself won't be
+ * loadable when that dependency is missing (in the runtime environment).
+ * 
+ * @goal no-class-def-found-error-param
+ * @requiresProject false
+ */
+public class NoClassDefFoundErrorComponentMojo
+    extends AbstractMojo
+{
+    
+    /**
+     * @parameter default-value="foo"
+     */
+    private TestCase value;
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        value.getName();
+    }
+
+}

Propchange: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorComponentMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorInterfaceMojo.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorInterfaceMojo.java?rev=747854&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorInterfaceMojo.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorInterfaceMojo.java
 Wed Feb 25 16:42:47 2009
@@ -0,0 +1,39 @@
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.Mojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
+
+import junit.framework.TestCase;
+
+/**
+ * Implements a class from a provided-scope dependency, so that the mojo class 
itself won't be
+ * loadable when that dependency is missing (in the runtime environment).
+ * 
+ * @goal no-class-def-found-error-mojo
+ * @requiresProject false
+ */
+public class NoClassDefFoundErrorInterfaceMojo
+    extends TestCase
+    implements Mojo
+{
+    
+    private Log log;
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+    }
+
+    public Log getLog()
+    {
+        return log;
+    }
+
+    public void setLog( Log log )
+    {
+        this.log = log;
+    }
+
+}

Propchange: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/NoClassDefFoundErrorInterfaceMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/RequirementComponentLookupExceptionMojo.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/RequirementComponentLookupExceptionMojo.java?rev=747854&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/RequirementComponentLookupExceptionMojo.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/RequirementComponentLookupExceptionMojo.java
 Wed Feb 25 16:42:47 2009
@@ -0,0 +1,27 @@
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.Mojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * @goal requirement-component-lookup-exception
+ * @requiresProject false
+ */
+public class RequirementComponentLookupExceptionMojo
+    extends AbstractMojo
+{
+    
+    /**
+     * @component role="missing-component" roleHint="triggers-error"
+     */
+    private Mojo dependency;
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        dependency.execute();
+    }
+
+}

Propchange: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-error/src/main/java/org/apache/maven/plugin/coreit/RequirementComponentLookupExceptionMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml?rev=747854&r1=747853&r2=747854&view=diff
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml 
(original)
+++ 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml 
Wed Feb 25 16:42:47 2009
@@ -1,5 +1,4 @@
 <?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
@@ -17,9 +16,7 @@
 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/maven-v4_0_0.xsd";>
+--><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>
@@ -43,6 +40,7 @@
     <module>maven-it-plugin-core-stubs</module>
     <module>maven-it-plugin-dependency-resolution</module>
     <module>maven-it-plugin-expression</module>
+    <module>maven-it-plugin-error</module>
     <module>maven-it-plugin-fork</module>
     <module>maven-it-plugin-log-file</module>
     <module>maven-it-plugin-no-project</module>
@@ -94,4 +92,4 @@
       </plugins>
     </pluginManagement>
   </build>
-</project>
+</project>
\ No newline at end of file


Reply via email to