You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2006/11/10 19:27:14 UTC

svn commit: r473414 - in /maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin: ./ src/main/java/org/apache/maven/plugin/eclipse/writers/rad/ src/test/java/org/apache/maven/plugin/eclipse/ src/test/resources/projects/project-rad-2/ src/test/resourc...

Author: jdcasey
Date: Fri Nov 10 10:27:13 2006
New Revision: 473414

URL: http://svn.apache.org/viewvc?view=rev&rev=473414
Log:
Switched tests to run using maven-plugin-testing-tools from the sandbox (it's bound for the shared component space eventually), so I can reuse the plugin-staging code elsewhere.

Added:
    maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/ExecutionFailedException.java   (with props)
Modified:
    maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/pom.xml
    maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java
    maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java
    maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/RadPluginTest.java
    maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-2/pom.xml
    maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-3/pom.xml
    maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-4/pom.xml

Modified: maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/pom.xml?view=diff&rev=473414&r1=473413&r2=473414
==============================================================================
--- maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/pom.xml (original)
+++ maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/pom.xml Fri Nov 10 10:27:13 2006
@@ -66,7 +66,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
-      <artifactId>maven-invoker</artifactId>
+      <artifactId>maven-plugin-testing-tools</artifactId>
       <version>1.0-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>

Modified: maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java?view=diff&rev=473414&r1=473413&r2=473414
==============================================================================
--- maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java (original)
+++ maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java Fri Nov 10 10:27:13 2006
@@ -53,28 +53,35 @@
     private String getMetaInfBaseDirectory( MavenProject project )
     {
         String metaInfBaseDirectory = null;
-        Iterator iterator = project.getResources().iterator();
-        while ( iterator.hasNext() )
+        
+        if ( config.getProject().getPackaging().equals( Constants.PROJECT_PACKAGING_WAR ) )
         {
-            metaInfBaseDirectory = ( (Resource) iterator.next() ).getDirectory();
+            metaInfBaseDirectory = config.getProject().getBasedir().getAbsolutePath() + File.separatorChar + WEBAPP_RESOURCE_DIR;
+            
+            log.debug( "Attempting to use: " + metaInfBaseDirectory + " for location of META-INF in war project." );
             
             File metaInfDirectoryFile = new File( metaInfBaseDirectory + File.separatorChar + META_INF_DIRECTORY );
             
-            if ( !metaInfDirectoryFile.isDirectory() )
+            if ( metaInfDirectoryFile.exists() && !metaInfDirectoryFile.isDirectory() )
             {
                 metaInfBaseDirectory = null;
             }
         }
         
-        if ( metaInfBaseDirectory == null && config.getProject().getPackaging().equals( Constants.PROJECT_PACKAGING_WAR ) )
+        if ( metaInfBaseDirectory == null )
         {
-            metaInfBaseDirectory = config.getProject().getBasedir().getAbsolutePath() + File.separatorChar + WEBAPP_RESOURCE_DIR;
-            
-            System.out.println( "Using: " + metaInfBaseDirectory + " for location of META-INF in war project." );
-            
-            if ( !new File( metaInfBaseDirectory + File.separatorChar + META_INF_DIRECTORY ).exists() )
+            for ( Iterator iterator = project.getResources().iterator(); iterator.hasNext(); )
             {
-                metaInfBaseDirectory = null;
+                metaInfBaseDirectory = ( (Resource) iterator.next() ).getDirectory();
+                
+                File metaInfDirectoryFile = new File( metaInfBaseDirectory + File.separatorChar + META_INF_DIRECTORY );
+                
+                log.debug( "Checking for existence of META-INF directory: " + metaInfDirectoryFile );
+                
+                if ( metaInfDirectoryFile.exists() && !metaInfDirectoryFile.isDirectory() )
+                {
+                    metaInfBaseDirectory = null;
+                }
             }
         }
         

Modified: maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java?view=diff&rev=473414&r1=473413&r2=473414
==============================================================================
--- maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java (original)
+++ maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java Fri Nov 10 10:27:13 2006
@@ -15,47 +15,27 @@
  */
 package org.apache.maven.plugin.eclipse;
 
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.installer.ArtifactInstallationException;
-import org.apache.maven.artifact.installer.ArtifactInstaller;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.model.Build;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Parent;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
 import org.apache.maven.plugin.ide.IdeUtils;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectBuilder;
-import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.artifact.ProjectArtifactMetadata;
-import org.apache.maven.shared.invoker.DefaultInvocationRequest;
-import org.apache.maven.shared.invoker.DefaultInvoker;
-import org.apache.maven.shared.invoker.InvocationOutputHandler;
 import org.apache.maven.shared.invoker.InvocationRequest;
-import org.apache.maven.shared.invoker.Invoker;
-import org.apache.maven.shared.invoker.MavenInvocationException;
+import org.apache.maven.shared.invoker.InvocationResult;
+import org.apache.maven.shared.test.plugin.BuildTool;
+import org.apache.maven.shared.test.plugin.PluginTestTool;
+import org.apache.maven.shared.test.plugin.ProjectTool;
+import org.apache.maven.shared.test.plugin.TestToolsException;
 import org.codehaus.classworlds.ClassRealm;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.cli.CommandLineUtils;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileFilter;
 import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.net.MalformedURLException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -70,20 +50,14 @@
     extends PlexusTestCase
 {
 
-    private static Invoker mavenInvoker = new DefaultInvoker();
+    private BuildTool buildTool;
 
-    /**
-     * The embedder.
-     */
-    //    protected MavenEmbedder maven;
-    private ArtifactRepository localRepository;
-
-    private MavenProjectBuilder projectBuilder;
+    private ProjectTool projectTool;
 
     /**
      * Test repository directory.
      */
-    protected static final File LOCAL_REPO_DIR = getTestFile( "target/test-classes/m2repo" );
+    protected static File localRepositoryDirectory = getTestFile( "target/test-classes/m2repo" );
 
     /**
      * Group-Id for running test builds.
@@ -102,8 +76,6 @@
     protected static final String VERSION = "test";
 
     private static final String BUILD_OUTPUT_DIRECTORY = "target/surefire-reports/build-output";
-    
-    private static String mvnHome;
 
     private static boolean installed = false;
 
@@ -115,239 +87,31 @@
     {
         if ( !installed )
         {
-            System.out.println( "*** Running test builds; output will be directed to: " + BUILD_OUTPUT_DIRECTORY + "\n" );
-        }
-        
-        synchronized( AbstractEclipsePluginTestCase.class )
-        {
-            if ( mvnHome == null )
-            {
-                mvnHome = System.getProperty( "maven.home" );
-                
-                if ( mvnHome == null )
-                {
-                    Properties envVars = CommandLineUtils.getSystemEnvVars();
-                    
-                    mvnHome = envVars.getProperty( "M2_HOME" );
-                }
-            }
-            
-            if ( mvnHome != null )
-            {
-                mavenInvoker.setMavenHome( new File( mvnHome ) );
-            }
+            System.out
+                .println( "*** Running test builds; output will be directed to: " + BUILD_OUTPUT_DIRECTORY + "\n" );
         }
-        
-        //        this.maven = new MavenEmbedder();
-        //        this.maven.setClassLoader( Thread.currentThread().getContextClassLoader() );
-        //        this.maven.setLogger( new MavenEmbedderConsoleLogger() );
-        //        this.maven.setLocalRepositoryDirectory( LOCAL_REPO_DIR );
-        //        this.maven.setOffline( true );
-        //        this.maven.setInteractiveMode( false );
-        //        this.maven.start();
 
         super.setUp();
 
-        projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
-        createLocalArtifactRepositoryInstance();
-
-        // We need to call super.setup() first, to ensure that we can use the PlexusContainer 
-        // initialized in the parent class.
-        installPluginInTestLocalRepository();
-    }
-
-    protected void createLocalArtifactRepositoryInstance()
-        throws Exception
-    {
-        ArtifactRepositoryFactory repoFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
-        ArtifactRepositoryLayout defaultLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
-                                                                                    "default" );
-
-        localRepository = repoFactory.createArtifactRepository( "local", LOCAL_REPO_DIR.toURL().toExternalForm(),
-                                                                defaultLayout, null, null );
+        buildTool = (BuildTool) lookup( BuildTool.ROLE, "default" );
 
-    }
+        projectTool = (ProjectTool) lookup( ProjectTool.ROLE, "default" );
 
-    protected void installPluginInTestLocalRepository()
-        throws Exception
-    {
-        // synchronizing just in case we try to parallelize later...
         synchronized ( AbstractEclipsePluginTestCase.class )
         {
             if ( !installed )
             {
-                System.out.println( "*** Installing test-version of the Eclipse plugin to: " + LOCAL_REPO_DIR + "\n" );
-
-                ArtifactInstaller installer = (ArtifactInstaller) lookup( ArtifactInstaller.ROLE );
-                ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
-
-                Artifact artifact = factory.createArtifact( GROUP_ID, ARTIFACT_ID, VERSION, null, "maven-plugin" );
-
-                File pomFile = manglePom();
-                File artifactFile = new File( "target/" + ARTIFACT_ID + "-" + VERSION + ".jar" );
-                
-                artifact.addMetadata( new ProjectArtifactMetadata( artifact, pomFile ) );
-
-                Properties properties = new Properties();
-//                properties.setProperty( "maven.test.skip", "true" );
-                
-                List goals = new ArrayList();
-                goals.add( "package" );
-                
-                executeMaven( pomFile, properties, goals, false );
-                
-                artifact.setFile( artifactFile );
-
-                String localPath = localRepository.pathOf( artifact );
-
-                File destination = new File( localRepository.getBasedir(), localPath );
-                if ( !destination.getParentFile().exists() )
-                {
-                    destination.getParentFile().mkdirs();
-                }
+                PluginTestTool pluginTestTool = (PluginTestTool) lookup( PluginTestTool.ROLE, "default" );
 
-                installer.install( artifactFile, artifact, localRepository );
+                localRepositoryDirectory = pluginTestTool.preparePluginForUnitTestingWithMavenBuilds( "test", localRepositoryDirectory );
 
-                installLocalParentSnapshotPoms( pomFile, installer, factory, localRepository );
+                System.out.println( "*** Installed test-version of the Eclipse plugin to: " + localRepositoryDirectory
+                    + "\n" );
 
                 installed = true;
             }
         }
-    }
-
-    private File manglePom() throws IOException, XmlPullParserException
-    {
-        File input = new File( "pom.xml" );
-        
-        File output = new File( "pom-test.xml" );
-        output.deleteOnExit();
-        
-        FileReader reader = null;
-        FileWriter writer = null;
-        
-        try
-        {
-            reader = new FileReader( input );
-            writer = new FileWriter( output );
-            
-            Model model = new MavenXpp3Reader().read( reader );
-            
-            model.setVersion( "test" );
-            
-            Build build = model.getBuild();
-            if ( build == null )
-            {
-                build = new Build();
-                model.setBuild( build );
-            }
-            
-            List plugins = build.getPlugins();
-            Plugin plugin = null;
-            for ( Iterator iter = plugins.iterator(); iter.hasNext(); )
-            {
-                Plugin plug = (Plugin) iter.next();
-                
-                if ( "maven-surefire-plugin".equals( plug.getArtifactId() ) )
-                {
-                    plugin = plug;
-                    break;
-                }
-            }
-            
-            if ( plugin == null )
-            {
-                plugin = new Plugin();
-                plugin.setArtifactId( "maven-surefire-plugin" );
-                build.addPlugin( plugin );
-            }
-            
-            Xpp3Dom configDom = (Xpp3Dom) plugin.getConfiguration();
-            if ( configDom == null )
-            {
-                configDom = new Xpp3Dom( "configuration" );
-                plugin.setConfiguration( configDom );
-            }
-            
-            Xpp3Dom skipDom = new Xpp3Dom( "skip" );
-            skipDom.setValue( "true" );
-            
-            configDom.addChild( skipDom );
-            
-            new MavenXpp3Writer().write( writer, model );
-        }
-        finally
-        {
-            IOUtil.close( reader );
-            IOUtil.close( writer );
-        }
-        
-        return output;
-    }
-
-    private void installLocalParentSnapshotPoms( File pomFile, ArtifactInstaller installer, ArtifactFactory factory,
-                                                 ArtifactRepository localRepo )
-        throws IOException, XmlPullParserException, ArtifactInstallationException
-    {
-        MavenXpp3Reader pomReader = new MavenXpp3Reader();
-
-        File pom = pomFile;
-
-        boolean firstPass = true;
-
-        while ( pom != null )
-        {
-
-            if ( !pom.exists() )
-            {
-                pom = null;
-                break;
-            }
-
-            String pomGroupId = null;
-            String pomArtifactId = null;
-            String pomVersion = null;
-
-            FileReader reader = null;
-
-            File currentPom = pom;
-
-            try
-            {
-                reader = new FileReader( pom );
-
-                Model model = pomReader.read( reader );
-
-                pomGroupId = model.getGroupId();
-                pomArtifactId = model.getArtifactId();
-                pomVersion = model.getVersion();
-
-                Parent parent = model.getParent();
-                if ( parent != null )
-                {
-                    pom = new File( pom.getParentFile(), parent.getRelativePath() );
-                }
-                else
-                {
-                    pom = null;
-                }
-            }
-            finally
-            {
-                IOUtil.close( reader );
-            }
-
-            if ( !firstPass )
-            {
-                Artifact pomArtifact = factory.createProjectArtifact( pomGroupId, pomArtifactId, pomVersion );
-                pomArtifact.addMetadata( new ProjectArtifactMetadata( pomArtifact, currentPom ) );
 
-                installer.install( currentPom, pomArtifact, localRepo );
-            }
-            else
-            {
-                firstPass = false;
-            }
-        }
     }
 
     /**
@@ -356,16 +120,10 @@
     protected void tearDown()
         throws Exception
     {
-        //        maven.stop();
-        //        super.tearDown();
-        //
-        //        Field embedderField = maven.getClass().getDeclaredField( "embedder" );
-        //        embedderField.setAccessible( true );
-        //        Embedder embedder = (Embedder) embedderField.get( maven );
+        super.tearDown();
 
         List containers = new ArrayList();
 
-        //        containers.add( embedder.getContainer() );
         containers.add( getContainer() );
 
         for ( Iterator iter = containers.iterator(); iter.hasNext(); )
@@ -424,14 +182,14 @@
         File basedir = getTestFile( "target/test-classes/projects/" + projectName );
 
         File pom = new File( basedir, "pom.xml" );
-        
+
         String pluginSpec = getPluginCLISpecification();
 
         List goals = new ArrayList();
 
         goals.add( pluginSpec + cleanGoal );
         goals.add( pluginSpec + genGoal );
-        
+
         executeMaven( pom, properties, goals );
 
         MavenProject project = readProject( pom );
@@ -458,48 +216,73 @@
     }
 
     protected void executeMaven( File pom, Properties properties, List goals )
-        throws MavenInvocationException
+        throws TestToolsException, ExecutionFailedException
     {
         executeMaven( pom, properties, goals, true );
     }
-    
+
     protected void executeMaven( File pom, Properties properties, List goals, boolean switchLocalRepo )
-        throws MavenInvocationException
+        throws TestToolsException, ExecutionFailedException
     {
-        InvocationRequest request = new DefaultInvocationRequest();
+        new File( BUILD_OUTPUT_DIRECTORY ).mkdirs();
         
-//        request.setDebug( true );
-        
-        if ( switchLocalRepo )
+        NullPointerException npe = new NullPointerException();
+        StackTraceElement[] trace = npe.getStackTrace();
+
+        File buildLog = null;
+
+        for ( int i = 0; i < trace.length; i++ )
         {
-            request.setLocalRepositoryDirectory( LOCAL_REPO_DIR );
+            StackTraceElement element = trace[i];
+
+            String methodName = element.getMethodName();
+
+            if ( methodName.startsWith( "test" ) && !methodName.equals( "testProject" ) )
+            {
+                String classname = element.getClassName();
+
+                buildLog = new File( BUILD_OUTPUT_DIRECTORY, classname + "_" + element.getMethodName() + ".build.log" );
+
+                break;
+            }
         }
-        
-        request.setPomFile( pom );
 
-        request.setGoals( goals );
+        if ( buildLog == null )
+        {
+            buildLog = new File( BUILD_OUTPUT_DIRECTORY, "unknown.build.log" );
+        }
 
-        request.setProperties( properties );
-        
-        LoggerHandler handler = new LoggerHandler( BUILD_OUTPUT_DIRECTORY );
-        
-        request.setOutputHandler( handler );
-        request.setErrorHandler( handler );
+        InvocationRequest request = buildTool.createBasicInvocationRequest( pom, properties, goals, buildLog );
+
+        request.setDebug( true );
 
-        try
+        if ( switchLocalRepo )
         {
-            mavenInvoker.execute( request );
+            request.setLocalRepositoryDirectory( localRepositoryDirectory );
         }
-        finally
+
+        InvocationResult result = buildTool.executeMaven( request );
+        
+        if ( result.getExitCode() != 0 )
         {
-            handler.close();
+            String buildLogUrl = buildLog.getAbsolutePath();
+            
+            try
+            {
+                buildLogUrl = buildLog.toURL().toExternalForm();
+            }
+            catch ( MalformedURLException e )
+            {
+            }
+            
+            throw new ExecutionFailedException( "Failed to execute build.\nPOM: " + pom + "\nGoals: " + StringUtils.join( goals.iterator(), ", " ) + "\nExit Code: " + result.getExitCode() + "\nError: " + result.getExecutionException() + "\nBuild Log: " + buildLogUrl + "\n", result );
         }
     }
-    
+
     protected MavenProject readProject( File pom )
-        throws ProjectBuildingException
+        throws TestToolsException
     {
-        return projectBuilder.build( pom, localRepository, null );
+        return projectTool.readProject( pom, localRepositoryDirectory );
     }
 
     protected String getPluginCLISpecification()
@@ -545,8 +328,9 @@
             {
                 File file = files[j];
 
-                assertFileEquals( LOCAL_REPO_DIR.getCanonicalPath(), file, new File( projectOutputDir, additionalDir
-                    + file.getName() ) );
+                assertFileEquals( localRepositoryDirectory.getCanonicalPath(), file, new File( projectOutputDir,
+                                                                                               additionalDir
+                                                                                                   + file.getName() ) );
 
             }
         }
@@ -568,8 +352,8 @@
             // replace some vars in the expected line, to account
             // for absolute paths that are different on each installation.
             expected = StringUtils.replace( expected, "${basedir}", basedir );
-            expected = StringUtils.replace( expected, "${M2_REPO}", LOCAL_REPO_DIR.getCanonicalPath().replace( '\\',
-                                                                                                               '/' ) );
+            expected = StringUtils.replace( expected, "${M2_REPO}", localRepositoryDirectory.getCanonicalPath()
+                .replace( '\\', '/' ) );
 
             if ( actualLines.size() <= i )
             {
@@ -643,75 +427,5 @@
 
         return lines;
     }
-    
-    private static final class LoggerHandler implements InvocationOutputHandler
-    {
-        private static final String LS = System.getProperty( "line.separator" );
-        private final File output;
-        private FileWriter writer;
-
-        LoggerHandler( String outputBasedir )
-        {
-            NullPointerException npe = new NullPointerException();
-            StackTraceElement[] trace = npe.getStackTrace();
-            
-            File file = null;
-            
-            for ( int i = 0; i < trace.length; i++ )
-            {
-                StackTraceElement element = trace[i];
-                
-                String methodName = element.getMethodName();
-                
-                if ( methodName.startsWith( "test" ) && !methodName.equals( "testProject" ) )
-                {
-                    String classname = element.getClassName();
-                    
-                    file = new File( outputBasedir, classname + "_" + element.getMethodName() + ".build.log" );
-                    
-                    break;
-                }
-            }
-            
-            if ( file == null )
-            {
-                file = new File( outputBasedir, "unknown.build.log" );
-            }
-            
-            file.getParentFile().mkdirs();
-            
-            output = file;
-        }
 
-        public void consumeLine( String line )
-        {
-            if ( writer == null )
-            {
-                try
-                {
-                    writer = new FileWriter( output );
-                }
-                catch ( IOException e )
-                {
-                    throw new IllegalStateException( "Failed to open build log: " + output + "\n\nError: " + e.getMessage() );
-                }
-            }
-            
-            try
-            {
-                writer.write( line + LS );
-                writer.flush();
-            }
-            catch ( IOException e )
-            {
-                throw new IllegalStateException( "Failed to write to build log: " + output + " output:\n\n\'" + line + "\'\n\nError: " + e.getMessage() );
-            }
-        }
-        
-        void close()
-        {
-            IOUtil.close( writer );
-        }
-        
-    }
 }

Added: maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/ExecutionFailedException.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/ExecutionFailedException.java?view=auto&rev=473414
==============================================================================
--- maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/ExecutionFailedException.java (added)
+++ maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/ExecutionFailedException.java Fri Nov 10 10:27:13 2006
@@ -0,0 +1,31 @@
+package org.apache.maven.plugin.eclipse;
+
+import org.apache.maven.shared.invoker.InvocationResult;
+import org.apache.maven.shared.invoker.MavenInvocationException;
+
+public class ExecutionFailedException
+    extends Exception
+{
+
+    private static final long serialVersionUID = 1L;
+    
+    private InvocationResult result;
+
+    public ExecutionFailedException( String message, MavenInvocationException cause )
+    {
+        super( message + " (Maven invoker threw an exception.)", cause );
+    }
+
+    public ExecutionFailedException( String message, InvocationResult result )
+    {
+        super( message + " (Resulting exit code: " + result.getExitCode() + ")" );
+        
+        this.result = result;
+    }
+    
+    public InvocationResult getInvocationResult()
+    {
+        return result;
+    }
+
+}

Propchange: maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/ExecutionFailedException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/ExecutionFailedException.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/RadPluginTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/RadPluginTest.java?view=diff&rev=473414&r1=473413&r2=473414
==============================================================================
--- maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/RadPluginTest.java (original)
+++ maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/RadPluginTest.java Fri Nov 10 10:27:13 2006
@@ -49,7 +49,7 @@
         testProject( "project-rad-2", new Properties(), "rad-clean", "rad" );
         File generatedManifest = getTestFile( PROJECTS_BASEDIR + "/project-rad-2/src/main/webapp/META-INF/MANIFEST.MF" );
         File expectedManifest = getTestFile( PROJECTS_BASEDIR + "/project-rad-2/src/main/webapp/META-INF/expected_MANIFEST.MF" );
-        assertFileEquals( LOCAL_REPO_DIR.getCanonicalPath(), expectedManifest, generatedManifest );
+        assertFileEquals( localRepositoryDirectory.getCanonicalPath(), expectedManifest, generatedManifest );
 
     }
 
@@ -59,7 +59,7 @@
         testProject( "project-rad-3", new Properties(), "rad-clean", "rad" );
         File generatedManifest = getTestFile( PROJECTS_BASEDIR + "/project-rad-3/ejbModule/META-INF/MANIFEST.MF" );
         File expectedManifest = getTestFile( PROJECTS_BASEDIR + "/project-rad-3/ejbModule/META-INF/expected_MANIFEST.MF" );
-        assertFileEquals( LOCAL_REPO_DIR.getCanonicalPath(), expectedManifest, generatedManifest );
+        assertFileEquals( localRepositoryDirectory.getCanonicalPath(), expectedManifest, generatedManifest );
     }
 
     public void testProject4()

Modified: maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-2/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-2/pom.xml?view=diff&rev=473414&r1=473413&r2=473414
==============================================================================
--- maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-2/pom.xml (original)
+++ maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-2/pom.xml Fri Nov 10 10:27:13 2006
@@ -7,7 +7,6 @@
 	<groupId>eclipse.test</groupId>
 	<artifactId>project-rad-2</artifactId>
 	<version>0.0.1-SNAPSHOT</version>
-	<name>Maven</name>
 	<dependencies>
 		<dependency>
 			<groupId>maven</groupId>

Modified: maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-3/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-3/pom.xml?view=diff&rev=473414&r1=473413&r2=473414
==============================================================================
--- maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-3/pom.xml (original)
+++ maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-3/pom.xml Fri Nov 10 10:27:13 2006
@@ -7,7 +7,6 @@
 	<groupId>eclipse.test</groupId>
 	<artifactId>project-rad-3</artifactId>
 	<version>0.0.1-SNAPSHOT</version>
-	<name>Maven</name>
 	<dependencies>
 		<dependency>
 			<groupId>maven</groupId>

Modified: maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-4/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-4/pom.xml?view=diff&rev=473414&r1=473413&r2=473414
==============================================================================
--- maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-4/pom.xml (original)
+++ maven/plugins/branches/MECLIPSE-137/maven-eclipse-plugin/src/test/resources/projects/project-rad-4/pom.xml Fri Nov 10 10:27:13 2006
@@ -6,7 +6,6 @@
 	<groupId>eclipse.test</groupId>
 	<artifactId>project-rad-4</artifactId>
 	<version>0.0.1-SNAPSHOT</version>
-	<name>Maven</name>
 	<dependencies>
 		<dependency>
 			<groupId>maven</groupId>