maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: maven-components/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade MarmaladeMojo.java
Date Wed, 20 Apr 2005 16:41:37 GMT
brett       2005/04/20 09:41:36

  Modified:    maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant
                        AbstractArtifactTask.java DependenciesTask.java
               maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean
                        CleanPlugin.java
               maven-plugins/maven-install-plugin pom.xml
               maven-core/src/main/java/org/apache/maven/artifact/metadata
                        MavenMetadata.java
               maven-core/src/main/java/org/apache/maven/artifact
                        MavenMetadataSource.java
               maven-core/src/main/java/org/apache/maven/cli MavenCli.java
               maven-core/src/main/java/org/apache/maven/lifecycle
                        DefaultLifecycleExecutor.java
               maven-core/src/main/java/org/apache/maven/plugin
                        DefaultPluginManager.java PluginManager.java
               maven-core/src/main/java/org/apache/maven/project/interpolation
                        RegexBasedModelInterpolator.java
               maven-core/src/main/java/org/apache/maven/project/path
                        DefaultPathTranslator.java
               maven-core/src/main/java/org/apache/maven/project
                        DefaultMavenProjectBuilder.java
               maven-core/src/main/java/org/apache/maven DefaultMaven.java
               maven-core/src/test/java/org/apache/maven/plugin
                        PluginParameterExpressionEvaluatorTest.java
               maven-core/src/test/java/org/apache/maven/project/inheritance
                        ProjectInheritanceTestCase.java
               maven-core/src/test/java/org/apache/maven/project
                        ProjectClasspathArtifactResolver.java
               maven-core/src/test/java/org/apache/maven/util/introspection
                        ReflectionValueExtractorTest.java
               maven-core pom.xml
               maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util
                        PluginUtilsTest.java
               maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly
                        AssemblyMojo.java
               maven-artifact/src/main/java/org/apache/maven/artifact/manager
                        DefaultWagonManager.java
               maven-artifact/src/main/java/org/apache/maven/artifact/metadata
                        SnapshotArtifactMetadata.java
               maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources
                        ResourcesMojo.java
               maven-archetype/maven-archetypes/maven-archetype-mojo/src/main/resources/archetype-resources/src/main/java
                        MyMojo.java
               maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade
                        MarmaladeMojo.java
  Log:
  improved error handling and other clean up
  
  Revision  Changes    Path
  1.3       +3 -2      maven-components/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java
  
  Index: AbstractArtifactTask.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractArtifactTask.java	18 Apr 2005 07:09:16 -0000	1.2
  +++ AbstractArtifactTask.java	20 Apr 2005 16:41:35 -0000	1.3
  @@ -20,6 +20,7 @@
   import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Task;
  +import org.codehaus.plexus.PlexusContainerException;
   import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
   import org.codehaus.plexus.embed.Embedder;
   
  @@ -85,7 +86,7 @@
                   {
                       embedder.start();
                   }
  -                catch ( Exception e )
  +                catch ( PlexusContainerException e )
                   {
                       throw new BuildException( "Unable to start embedder", e );
                   }
  
  
  
  1.2       +2 -2      maven-components/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java
  
  Index: DependenciesTask.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DependenciesTask.java	18 Apr 2005 04:12:35 -0000	1.1
  +++ DependenciesTask.java	20 Apr 2005 16:41:35 -0000	1.2
  @@ -107,7 +107,7 @@
               }
               catch ( ArtifactPathFormatException e )
               {
  -                throw new BuildException( "Unable to determine path to artifact: " + artifact );
  +                throw new BuildException( "Unable to determine path to artifact: " + artifact, e );
               }
   
               FileList.FileName file = new FileList.FileName();
  
  
  
  1.8       +2 -9      maven-components/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanPlugin.java
  
  Index: CleanPlugin.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean/CleanPlugin.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CleanPlugin.java	20 Apr 2005 04:16:10 -0000	1.7
  +++ CleanPlugin.java	20 Apr 2005 16:41:35 -0000	1.8
  @@ -53,14 +53,7 @@
               if ( dir.exists() && dir.isDirectory() )
               {
                   getLog().info( "Deleting directory " + dir.getAbsolutePath() );
  -                try
  -                {
  -                    removeDir( dir );
  -                }
  -                catch ( Exception e )
  -                {
  -                    throw new PluginExecutionException( "Unable to delete directory", e );
  -                }
  +                removeDir( dir );
               }
           }
       }
  
  
  
  1.15      +1 -1      maven-components/maven-plugins/maven-install-plugin/pom.xml
  
  Index: pom.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-install-plugin/pom.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- pom.xml	13 Apr 2005 05:11:49 -0000	1.14
  +++ pom.xml	20 Apr 2005 16:41:35 -0000	1.15
  @@ -19,7 +19,7 @@
       <dependency>
         <groupId>org.apache.maven</groupId>
         <artifactId>maven-artifact</artifactId>
  -      <version>2.0-alpha-1</version>
  +      <version>2.0-SNAPSHOT</version>
       </dependency>
     </dependencies>
   </model>
  
  
  
  1.5       +13 -2     maven-components/maven-core/src/main/java/org/apache/maven/artifact/metadata/MavenMetadata.java
  
  Index: MavenMetadata.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/artifact/metadata/MavenMetadata.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MavenMetadata.java	29 Mar 2005 16:41:13 -0000	1.4
  +++ MavenMetadata.java	20 Apr 2005 16:41:35 -0000	1.5
  @@ -24,10 +24,13 @@
   import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
   import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
   import org.codehaus.plexus.util.IOUtil;
  +import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
   
   import java.io.File;
  +import java.io.FileNotFoundException;
   import java.io.FileReader;
   import java.io.FileWriter;
  +import java.io.IOException;
   
   /**
    * Attach a POM to an artifact.
  @@ -80,7 +83,15 @@
               MavenXpp3Writer modelWriter = new MavenXpp3Writer();
               modelWriter.write( writer, model );
           }
  -        catch ( Exception e )
  +        catch ( FileNotFoundException e )
  +        {
  +            throw new ArtifactMetadataRetrievalException( "Error rewriting POM", e );
  +        }
  +        catch ( IOException e )
  +        {
  +            throw new ArtifactMetadataRetrievalException( "Error rewriting POM", e );
  +        }
  +        catch ( XmlPullParserException e )
           {
               throw new ArtifactMetadataRetrievalException( "Error rewriting POM", e );
           }
  
  
  
  1.30      +13 -2     maven-components/maven-core/src/main/java/org/apache/maven/artifact/MavenMetadataSource.java
  
  Index: MavenMetadataSource.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/artifact/MavenMetadataSource.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- MavenMetadataSource.java	8 Apr 2005 04:48:04 -0000	1.29
  +++ MavenMetadataSource.java	20 Apr 2005 16:41:35 -0000	1.30
  @@ -29,8 +29,11 @@
   import org.apache.maven.project.MavenProjectBuilder;
   import org.apache.maven.project.ProjectBuildingException;
   import org.apache.maven.wagon.util.IoUtils;
  +import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
   
  +import java.io.FileNotFoundException;
   import java.io.FileReader;
  +import java.io.IOException;
   import java.util.List;
   import java.util.Set;
   
  @@ -111,10 +114,18 @@
                   Model model = this.reader.read( reader );
                   dependencies = model.getDependencies();
               }
  -            catch ( Exception e )
  +            catch ( FileNotFoundException e )
  +            {
  +                throw new ArtifactMetadataRetrievalException( "Unable to find the metadata file", e );
  +            }
  +            catch ( IOException e )
               {
                   throw new ArtifactMetadataRetrievalException( "Unable to read the metadata file", e );
               }
  +            catch ( XmlPullParserException e )
  +            {
  +                throw new ArtifactMetadataRetrievalException( "Unable to parse the metadata file", e );
  +            }
               finally
               {
                   IoUtils.close( reader );
  
  
  
  1.33      +33 -13    maven-components/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
  
  Index: MavenCli.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- MavenCli.java	20 Apr 2005 04:16:10 -0000	1.32
  +++ MavenCli.java	20 Apr 2005 16:41:35 -0000	1.33
  @@ -1,20 +1,19 @@
   package org.apache.maven.cli;
   
  -/* ====================================================================
  - *   Copyright 2001-2004 The Apache Software Foundation.
  +/*
  + * 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
  + * 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
  + *      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.
  - * ====================================================================
  + * 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.commons.cli.CommandLine;
  @@ -91,6 +90,16 @@
               return 1;
           }
   
  +        // TODO: maybe classworlds could handle this requirement...
  +        if ( System.getProperty( "java.class.version", "44.0" ).compareTo( "48.0" ) < 0 )
  +        {
  +            System.err.println( "Sorry, but JDK 1.4 or above is required to execute Maven" );
  +            System.err.println(
  +                "You appear to be using Java version: " + System.getProperty( "java.version", "<unknown>" ) );
  +
  +            return 1;
  +        }
  +
           // ----------------------------------------------------------------------
           //
           // 1) maven user configuration directory ( ~/.m2 )
  @@ -194,6 +203,15 @@
               return 1;
           }
   
  +        // TODO: this should be in default maven, and should accommodate default goals
  +        if ( request.getGoals().isEmpty() )
  +        {
  +            System.err.println( "You must specify at least one goal. Try 'install'" );
  +
  +            cliManager.displayHelp();
  +            return 1;
  +        }
  +
           MavenExecutionResponse response = null;
           try
           {
  @@ -463,6 +481,8 @@
   
           public void displayHelp()
           {
  +            System.out.println();
  +
               HelpFormatter formatter = new HelpFormatter();
               formatter.printHelp( "maven [options] [goal [goal2 [goal3] ...]]", "\nOptions:", options, "\n" );
           }
  
  
  
  1.37      +70 -41    maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
  
  Index: DefaultLifecycleExecutor.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- DefaultLifecycleExecutor.java	20 Apr 2005 04:16:10 -0000	1.36
  +++ DefaultLifecycleExecutor.java	20 Apr 2005 16:41:35 -0000	1.37
  @@ -19,6 +19,7 @@
   import org.apache.maven.artifact.handler.ArtifactHandler;
   import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
   import org.apache.maven.artifact.handler.manager.ArtifactHandlerNotFoundException;
  +import org.apache.maven.artifact.resolver.ArtifactResolutionException;
   import org.apache.maven.artifact.resolver.ArtifactResolver;
   import org.apache.maven.execution.MavenExecutionResponse;
   import org.apache.maven.execution.MavenSession;
  @@ -86,6 +87,38 @@
   
           response.setStart( new Date() );
   
  +        try
  +        {
  +            processGoals( session, tasks );
  +        }
  +        catch ( PluginExecutionException e )
  +        {
  +            response.setException( e );
  +        }
  +        catch ( PluginNotFoundException e )
  +        {
  +            response.setException( e );
  +        }
  +        catch ( ArtifactHandlerNotFoundException e )
  +        {
  +            response.setException( e );
  +        }
  +        catch ( ArtifactResolutionException e )
  +        {
  +            response.setException( e );
  +        }
  +        finally
  +        {
  +            response.setFinish( new Date() );
  +        }
  +
  +        return response;
  +    }
  +
  +    private void processGoals( MavenSession session, List tasks )
  +        throws ArtifactHandlerNotFoundException, LifecycleExecutionException, PluginNotFoundException,
  +        PluginExecutionException, ArtifactResolutionException
  +    {
           Map phaseMap = new HashMap();
   
           for ( Iterator i = phases.iterator(); i.hasNext(); )
  @@ -96,38 +129,38 @@
               phaseMap.put( p.getId(), new Phase( p ) );
           }
   
  -        try
  -        {
  -            MavenProject project = session.getProject();
  +        MavenProject project = session.getProject();
   
  -            ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( project.getPackaging() );
  +        ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( project.getPackaging() );
   
  -            if ( artifactHandler != null )
  +        if ( artifactHandler != null )
  +        {
  +            if ( artifactHandler.packageGoal() != null )
               {
  -                if ( artifactHandler.packageGoal() != null )
  -                {
  -                    verifyMojoPhase( artifactHandler.packageGoal(), session, phaseMap );
  -                }
  +                verifyMojoPhase( artifactHandler.packageGoal(), session, phaseMap );
  +            }
   
  -                if ( artifactHandler.additionalPlugin() != null )
  -                {
  -                    String additionalPluginGroupId = PluginDescriptor.getDefaultPluginGroupId();
  +            if ( artifactHandler.additionalPlugin() != null )
  +            {
  +                String additionalPluginGroupId = PluginDescriptor.getDefaultPluginGroupId();
   
  -                    String additionalPluginArtifactId = PluginDescriptor.getDefaultPluginArtifactId(
  -                        artifactHandler.additionalPlugin() );
  +                String additionalPluginArtifactId = PluginDescriptor.getDefaultPluginArtifactId(
  +                    artifactHandler.additionalPlugin() );
   
  -                    injectHandlerPluginConfiguration( project, additionalPluginGroupId, additionalPluginArtifactId );
  -                }
  +                injectHandlerPluginConfiguration( project, additionalPluginGroupId, additionalPluginArtifactId );
               }
  +        }
   
  -            processPluginConfiguration( session.getProject(), session, phaseMap );
  +        processPluginConfiguration( session.getProject(), session, phaseMap );
   
  -            for ( Iterator i = tasks.iterator(); i.hasNext(); )
  -            {
  -                String task = (String) i.next();
  +        for ( Iterator i = tasks.iterator(); i.hasNext(); )
  +        {
  +            String task = (String) i.next();
   
  -                processGoalChain( task, session, phaseMap );
  +            processGoalChain( task, session, phaseMap );
   
  +            try
  +            {
                   if ( phaseMap.containsKey( task ) )
                   {
                       executePhase( task, session, phaseMap );
  @@ -137,25 +170,11 @@
                       executeMojo( task, session );
                   }
               }
  +            catch ( PluginManagerException e )
  +            {
  +                throw new LifecycleExecutionException( "Internal error in the plugin manager", e );
  +            }
           }
  -        catch ( PluginExecutionException e )
  -        {
  -            response.setException( e );
  -        }
  -        catch ( PluginNotFoundException e )
  -        {
  -            response.setException( e );
  -        }
  -        catch ( ArtifactHandlerNotFoundException e )
  -        {
  -            response.setException( e );
  -        }
  -        finally
  -        {
  -            response.setFinish( new Date() );
  -        }
  -
  -        return response;
       }
   
       private void injectHandlerPluginConfiguration( MavenProject project, String groupId, String artifactId )
  @@ -389,7 +408,7 @@
       }
   
       private void executePhase( String phase, MavenSession session, Map phaseMap )
  -        throws PluginExecutionException, PluginNotFoundException
  +        throws PluginExecutionException, PluginNotFoundException, PluginManagerException, ArtifactResolutionException
       {
           // only execute up to the given phase
           int index = phases.indexOf( phaseMap.get( phase ) );
  @@ -424,13 +443,23 @@
                   dispatcher.dispatchError( event, p.getId(), e );
                   throw e;
               }
  +            catch ( PluginManagerException e )
  +            {
  +                dispatcher.dispatchError( event, p.getId(), e );
  +                throw e;
  +            }
  +            catch ( ArtifactResolutionException e )
  +            {
  +                dispatcher.dispatchError( event, p.getId(), e );
  +                throw e;
  +            }
   
               dispatcher.dispatchEnd( event, p.getId() );
           }
       }
   
       protected void executeMojo( String id, MavenSession session )
  -        throws PluginExecutionException, PluginNotFoundException
  +        throws PluginExecutionException, PluginNotFoundException, PluginManagerException, ArtifactResolutionException
       {
           // ----------------------------------------------------------------------
           // We have something of the form <pluginId>:<mojoId>, so this might be
  
  
  
  1.84      +45 -78    maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
  
  Index: DefaultPluginManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- DefaultPluginManager.java	20 Apr 2005 04:16:10 -0000	1.83
  +++ DefaultPluginManager.java	20 Apr 2005 16:41:35 -0000	1.84
  @@ -262,21 +262,8 @@
               }
               catch ( ComponentLookupException e )
               {
  -                throw new PluginManagerException( "Internal configuration error while retrieving " + groupId + ":" + artifactId, e );
  -            }
  -            finally
  -            {
  -                if ( artifactFactory != null )
  -                {
  -                    try
  -                    {
  -                        container.release( artifactFactory );
  -                    }
  -                    catch ( ComponentLifecycleException e )
  -                    {
  -                        getLogger().error( "Error releasing component - ignoring", e );
  -                    }
  -                }
  +                throw new PluginManagerException(
  +                    "Internal configuration error while retrieving " + groupId + ":" + artifactId, e );
               }
           }
       }
  @@ -304,44 +291,35 @@
           {
               if ( artifactResolver != null )
               {
  -                try
  -                {
  -                    container.release( artifactResolver );
  -                }
  -                catch ( ComponentLifecycleException e )
  -                {
  -                    getLogger().error( "Error releasing component - ignoring", e );
  -                }
  +                releaseComponent( artifactResolver );
               }
               if ( mavenProjectBuilder != null )
               {
  -                try
  -                {
  -                    container.release( mavenProjectBuilder );
  -                }
  -                catch ( ComponentLifecycleException e )
  -                {
  -                    getLogger().error( "Error releasing component - ignoring", e );
  -                }
  +                releaseComponent( mavenProjectBuilder );
               }
           }
       }
   
  -    // ----------------------------------------------------------------------
  -    // Plugin execution
  -    // ----------------------------------------------------------------------
  -
  -    public void executeMojo( MavenSession session, String goalName )
  -        throws PluginExecutionException, PluginNotFoundException
  +    private void releaseComponent( Object component )
       {
           try
           {
  -            verifyPluginForGoal( goalName, session );
  +            container.release( component );
           }
  -        catch ( Exception e )
  +        catch ( ComponentLifecycleException e )
           {
  -            throw new PluginExecutionException( "Unable to execute goal: " + goalName, e );
  +            getLogger().error( "Error releasing component - ignoring", e );
           }
  +    }
  +
  +    // ----------------------------------------------------------------------
  +    // Plugin execution
  +    // ----------------------------------------------------------------------
  +
  +    public void executeMojo( MavenSession session, String goalName )
  +        throws PluginExecutionException, PluginNotFoundException, PluginManagerException, ArtifactResolutionException
  +    {
  +        verifyPluginForGoal( goalName, session );
   
           PluginExecutionRequest request = null;
   
  @@ -351,41 +329,37 @@
               throw new PluginExecutionException( "Unable to find goal: " + goalName );
           }
   
  -        try
  +        if ( mojoDescriptor.getRequiresDependencyResolution() != null )
           {
  -            if ( mojoDescriptor.getRequiresDependencyResolution() != null )
  -            {
   
  -                ArtifactResolver artifactResolver = null;
  -                MavenProjectBuilder mavenProjectBuilder = null;
  +            ArtifactResolver artifactResolver = null;
  +            MavenProjectBuilder mavenProjectBuilder = null;
   
  -                try
  -                {
  -                    artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE );
  -                    mavenProjectBuilder = (MavenProjectBuilder) container.lookup( MavenProjectBuilder.ROLE );
  +            try
  +            {
  +                artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE );
  +                mavenProjectBuilder = (MavenProjectBuilder) container.lookup( MavenProjectBuilder.ROLE );
   
  -                    resolveTransitiveDependencies( session, artifactResolver, mavenProjectBuilder,
  -                                                   mojoDescriptor.getRequiresDependencyResolution() );
  -                    downloadDependencies( session, artifactResolver );
  +                resolveTransitiveDependencies( session, artifactResolver, mavenProjectBuilder,
  +                                               mojoDescriptor.getRequiresDependencyResolution() );
  +                downloadDependencies( session, artifactResolver );
  +            }
  +            catch ( ComponentLookupException e )
  +            {
  +                throw new PluginManagerException( "Internal configuration error in plugin manager", e );
  +            }
  +            finally
  +            {
  +                if ( artifactResolver != null )
  +                {
  +                    releaseComponent( artifactResolver );
                   }
  -                finally
  +                if ( mavenProjectBuilder != null )
                   {
  -                    // TODO: watch out for the exceptions being thrown
  -                    if ( artifactResolver != null )
  -                    {
  -                        container.release( artifactResolver );
  -                    }
  -                    if ( mavenProjectBuilder != null )
  -                    {
  -                        container.release( mavenProjectBuilder );
  -                    }
  +                    releaseComponent( mavenProjectBuilder );
                   }
               }
           }
  -        catch ( Exception e )
  -        {
  -            throw new PluginExecutionException( "Unable to resolve required dependencies for goal", e );
  -        }
   
           Plugin plugin = null;
   
  @@ -421,9 +395,10 @@
                   configuration = new XmlPlexusConfiguration( dom );
               }
   
  +            ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator( session, pathTranslator );
  +
               configuration = mergeConfiguration( configuration, mojoDescriptor.getConfiguration() );
   
  -            ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator( session, pathTranslator );
               try
               {
                   if ( newMojoTechnique )
  @@ -486,15 +461,7 @@
           }
           finally
           {
  -            try
  -            {
  -                container.release( plugin );
  -            }
  -            catch ( Exception e )
  -            {
  -                // TODO: better error handling, needed!
  -                e.printStackTrace();
  -            }
  +            releaseComponent( plugin );
           }
       }
   
  @@ -634,11 +601,11 @@
                   }
                   catch ( NoSuchFieldException e )
                   {
  -                    throw new PluginConfigurationException( "Unable to set field '" + key + "' on '" + clazz + "'" );
  +                    throw new PluginConfigurationException( "Unable to set field '" + key + "' on '" + clazz + "'", e );
                   }
                   catch ( IllegalAccessException e )
                   {
  -                    throw new PluginConfigurationException( "Unable to set field '" + key + "' on '" + clazz + "'" );
  +                    throw new PluginConfigurationException( "Unable to set field '" + key + "' on '" + clazz + "'", e );
                   }
               }
           }
  
  
  
  1.20      +3 -2      maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
  
  Index: PluginManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- PluginManager.java	20 Apr 2005 04:16:11 -0000	1.19
  +++ PluginManager.java	20 Apr 2005 16:41:35 -0000	1.20
  @@ -17,6 +17,7 @@
    * ====================================================================
    */
   
  +import org.apache.maven.artifact.resolver.ArtifactResolutionException;
   import org.apache.maven.execution.MavenSession;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
   import org.apache.maven.plugin.descriptor.PluginDescriptor;
  @@ -30,7 +31,7 @@
       String ROLE = PluginManager.class.getName();
   
       void executeMojo( MavenSession session, String goalName )
  -        throws PluginExecutionException, PluginNotFoundException;
  +        throws PluginExecutionException, PluginNotFoundException, PluginManagerException, ArtifactResolutionException;
   
       MojoDescriptor getMojoDescriptor( String goalId );
   
  
  
  
  1.5       +10 -3     maven-components/maven-core/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java
  
  Index: RegexBasedModelInterpolator.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RegexBasedModelInterpolator.java	28 Mar 2005 14:37:40 -0000	1.4
  +++ RegexBasedModelInterpolator.java	20 Apr 2005 16:41:36 -0000	1.5
  @@ -23,7 +23,9 @@
   import org.codehaus.plexus.logging.AbstractLogEnabled;
   import org.codehaus.plexus.logging.Logger;
   import org.codehaus.plexus.util.StringUtils;
  +import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
   
  +import java.io.IOException;
   import java.io.StringReader;
   import java.io.StringWriter;
   import java.util.regex.Matcher;
  @@ -52,7 +54,7 @@
           {
               writer.write( sWriter, model );
           }
  -        catch ( Exception e )
  +        catch ( IOException e )
           {
               throw new ModelInterpolationException( "Cannot serialize project model for interpolation.", e );
           }
  @@ -67,7 +69,12 @@
           {
               model = modelReader.read( sReader );
           }
  -        catch ( Exception e )
  +        catch ( IOException e )
  +        {
  +            throw new ModelInterpolationException(
  +                "Cannot read project model from interpolating filter of serialized version.", e );
  +        }
  +        catch ( XmlPullParserException e )
           {
               throw new ModelInterpolationException(
                   "Cannot read project model from interpolating filter of serialized version.", e );
  
  
  
  1.10      +0 -1      maven-components/maven-core/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java
  
  Index: DefaultPathTranslator.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultPathTranslator.java	13 Mar 2005 01:45:38 -0000	1.9
  +++ DefaultPathTranslator.java	20 Apr 2005 16:41:36 -0000	1.10
  @@ -22,7 +22,6 @@
   
   import java.io.File;
   import java.util.Iterator;
  -import java.util.List;
   
   public class DefaultPathTranslator
       implements PathTranslator
  
  
  
  1.69      +27 -25    maven-components/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
  
  Index: DefaultMavenProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- DefaultMavenProjectBuilder.java	20 Apr 2005 04:16:11 -0000	1.68
  +++ DefaultMavenProjectBuilder.java	20 Apr 2005 16:41:36 -0000	1.69
  @@ -51,6 +51,7 @@
   import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
   import org.codehaus.plexus.util.IOUtil;
   import org.codehaus.plexus.util.StringUtils;
  +import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
   
   import java.io.File;
   import java.io.FileNotFoundException;
  @@ -162,7 +163,11 @@
           {
               settings = mavenSettingsBuilder.buildSettings();
           }
  -        catch ( Exception e )
  +        catch ( IOException e )
  +        {
  +            throw new ProjectBuildingException( "Cannot read settings.", e );
  +        }
  +        catch ( XmlPullParserException e )
           {
               throw new ProjectBuildingException( "Cannot read settings.", e );
           }
  @@ -193,7 +198,7 @@
               }
               catch ( ArtifactResolutionException e )
               {
  -                throw new ProjectBuildingException( "Unable to find artifact: " + artifact.toString() );
  +                throw new ProjectBuildingException( "Unable to find artifact: " + artifact.toString(), e );
               }
               model = readModel( artifact.getFile() );
           }
  @@ -267,27 +272,13 @@
   
           project = new MavenProject( model );
   
  -        try
  -        {
  -            project.setPluginArtifactRepositories( buildPluginRepositories( model.getPluginRepositories() ) );
  -        }
  -        catch ( Exception e )
  -        {
  -            throw new ProjectBuildingException( "Error building plugin repository list.", e );
  -        }
  +        project.setPluginArtifactRepositories( buildPluginRepositories( model.getPluginRepositories() ) );
   
           DistributionManagement dm = model.getDistributionManagement();
           if ( dm != null )
           {
  -            try
  -            {
  -                project.setDistributionManagementArtifactRepository( buildDistributionManagementRepository(
  -                    dm.getRepository() ) );
  -            }
  -            catch ( Exception e )
  -            {
  -                throw new ProjectBuildingException( "Error building distribution management repository.", e );
  -            }
  +            project.setDistributionManagementArtifactRepository( buildDistributionManagementRepository(
  +                dm.getRepository() ) );
           }
   
           project.setParent( parentProject );
  @@ -472,13 +463,18 @@
           }
           catch ( FileNotFoundException e )
           {
  -            throw new ProjectBuildingException( "Could not find the model file '" + file.getAbsolutePath() + "'." );
  +            throw new ProjectBuildingException( "Could not find the model file '" + file.getAbsolutePath() + "'.", e );
           }
  -        catch ( Exception e )
  +        catch ( IOException e )
           {
               throw new ProjectBuildingException(
                   "Error while reading model from file '" + file.getAbsolutePath() + "'.", e );
           }
  +        catch ( XmlPullParserException e )
  +        {
  +            throw new ProjectBuildingException(
  +                "Error while parsing model from file '" + file.getAbsolutePath() + "'.", e );
  +        }
           finally
           {
               IOUtil.close( reader );
  @@ -488,17 +484,23 @@
       private Model readModel( URL url )
           throws ProjectBuildingException
       {
  +        InputStreamReader reader = null;
           try
           {
  -            return modelReader.read( new InputStreamReader( url.openStream() ) );
  +            reader = new InputStreamReader( url.openStream() );
  +            return modelReader.read( reader );
           }
           catch ( IOException e )
           {
  -            throw new ProjectBuildingException( "Error while reading model.", e );
  +            throw new ProjectBuildingException( "Error while building model from " + url.toExternalForm(), e );
           }
  -        catch ( Exception ex )
  +        catch ( XmlPullParserException e )
           {
  -            throw new ProjectBuildingException( "Error while building model from " + url.toExternalForm(), ex );
  +            throw new ProjectBuildingException( "Error while building model from " + url.toExternalForm(), e );
  +        }
  +        finally
  +        {
  +            IOUtil.close( reader );
           }
       }
   
  
  
  
  1.48      +48 -34    maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
  
  Index: DefaultMaven.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/DefaultMaven.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- DefaultMaven.java	20 Apr 2005 04:16:11 -0000	1.47
  +++ DefaultMaven.java	20 Apr 2005 16:41:36 -0000	1.48
  @@ -87,11 +87,6 @@
       public MavenExecutionResponse execute( MavenExecutionRequest request )
           throws ReactorException
       {
  -        if ( request.getGoals().isEmpty() )
  -        {
  -            throw new ReactorException( "You must specify at least one goal. Try 'install'." );
  -        }
  -
           if ( request.getSettings().getActiveProfile().isOffline() )
           {
               getLogger().info( "Maven is running in offline mode." );
  @@ -103,34 +98,34 @@
           // TODO: goals are outer loop
           dispatcher.dispatchStart( event, request.getBaseDirectory() );
   
  +        List projects;
  +
           try
           {
  -            List projects;
  +            projects = collectProjects( request.getFiles(), request.getLocalRepository(), request.isRecursive() );
   
  -            try
  -            {
  -                projects = collectProjects( request.getFiles(), request.getLocalRepository(), request.isRecursive() );
  -
  -                projects = MavenProject.getSortedProjects( projects );
  +            projects = MavenProject.getSortedProjects( projects );
   
  -                if ( projects.isEmpty() )
  -                {
  -                    projects.add( projectBuilder.buildStandaloneSuperProject( request.getLocalRepository() ) );
  -                }
  -            }
  -            catch ( IOException e )
  -            {
  -                throw new ReactorException( "Error processing projects for the reactor: ", e );
  -            }
  -            catch ( ProjectBuildingException e )
  -            {
  -                throw new ReactorException( "Error processing projects for the reactor: ", e );
  -            }
  -            catch ( CycleDetectedException e )
  +            if ( projects.isEmpty() )
               {
  -                throw new ReactorException( "Error processing projects for the reactor: ", e );
  +                projects.add( projectBuilder.buildStandaloneSuperProject( request.getLocalRepository() ) );
               }
  +        }
  +        catch ( IOException e )
  +        {
  +            throw new ReactorException( "Error processing projects for the reactor: ", e );
  +        }
  +        catch ( ProjectBuildingException e )
  +        {
  +            throw new ReactorException( "Error processing projects for the reactor: ", e );
  +        }
  +        catch ( CycleDetectedException e )
  +        {
  +            throw new ReactorException( "Error processing projects for the reactor: ", e );
  +        }
   
  +        try
  +        {
               for ( Iterator iterator = projects.iterator(); iterator.hasNext(); )
               {
                   MavenProject project = (MavenProject) iterator.next();
  @@ -143,13 +138,13 @@
   
                   try
                   {
  -                    MavenExecutionResponse response = processProject( request, project, dispatcher, request.getGoals() );
  +                    MavenExecutionResponse response = processProject( request, project, dispatcher );
                       if ( response.isExecutionFailure() )
                       {
                           return response;
                       }
                   }
  -                catch ( Exception e )
  +                catch ( LifecycleExecutionException e )
                   {
                       throw new ReactorException( "Error executing project within the reactor", e );
                   }
  @@ -188,7 +183,7 @@
   
                   if ( includes.indexOf( ".." ) >= 0 )
                   {
  -                    throw new ReactorException( "Modules may not include '..'" );
  +                    throw new ProjectBuildingException( "Modules may not include '..'" );
                   }
   
                   List moduleFiles = FileUtils.getFiles( project.getFile().getParentFile(), includes, null );
  @@ -203,9 +198,11 @@
       }
   
       private MavenExecutionResponse processProject( MavenExecutionRequest request, MavenProject project,
  -                                                   EventDispatcher dispatcher, List goals )
  +                                                   EventDispatcher dispatcher )
           throws LifecycleExecutionException
       {
  +        List goals = request.getGoals();
  +
           MavenSession session = createSession( request, project );
   
           try
  @@ -252,6 +249,7 @@
                   }
                   else
                   {
  +                    // TODO: throw exceptions like this, so "failures" are just that
                       logError( response );
                   }
               }
  @@ -423,13 +421,29 @@
   
           secs = secs % 60;
   
  -        if ( min > 0 )
  +        String msg = "";
  +
  +        if ( min > 1 )
  +        {
  +            msg = min + " minutes ";
  +        }
  +        else if ( min == 1 )
  +        {
  +            msg = "1 minute ";
  +        }
  +
  +        if ( secs > 1 )
  +        {
  +            msg += secs + " seconds";
  +        }
  +        else if ( secs == 1 )
           {
  -            return min + " minutes " + secs + " seconds";
  +            msg += "1 second";
           }
           else
           {
  -            return secs + " seconds";
  +            msg += "< 1 second";
           }
  +        return msg;
       }
   }
  
  
  
  1.13      +0 -3      maven-components/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
  
  Index: PluginParameterExpressionEvaluatorTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PluginParameterExpressionEvaluatorTest.java	18 Apr 2005 21:50:54 -0000	1.12
  +++ PluginParameterExpressionEvaluatorTest.java	20 Apr 2005 16:41:36 -0000	1.13
  @@ -67,9 +67,6 @@
   
           String actual = new File( value.toString() ).getCanonicalPath();
   
  -        System.out.println( "Expected value: " + expected );
  -        System.out.println( "Resolved value: " + actual );
  -
           assertEquals( expected, actual );
       }
   
  
  
  
  1.8       +3 -4      maven-components/maven-core/src/test/java/org/apache/maven/project/inheritance/ProjectInheritanceTestCase.java
  
  Index: ProjectInheritanceTestCase.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/inheritance/ProjectInheritanceTestCase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ProjectInheritanceTestCase.java	23 Dec 2004 23:46:42 -0000	1.7
  +++ ProjectInheritanceTestCase.java	20 Apr 2005 16:41:36 -0000	1.8
  @@ -16,10 +16,9 @@
    * limitations under the License.
    */
   
  -import java.io.File;
  -
   import org.apache.maven.MavenTestCase;
  -import org.apache.maven.project.MavenProjectBuilder;
  +
  +import java.io.File;
   
   /**
    * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  
  
  
  1.8       +16 -3     maven-components/maven-core/src/test/java/org/apache/maven/project/ProjectClasspathArtifactResolver.java
  
  Index: ProjectClasspathArtifactResolver.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/ProjectClasspathArtifactResolver.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ProjectClasspathArtifactResolver.java	29 Mar 2005 16:41:13 -0000	1.7
  +++ ProjectClasspathArtifactResolver.java	20 Apr 2005 16:41:36 -0000	1.8
  @@ -30,8 +30,11 @@
   import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
   import org.apache.maven.model.Model;
   import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
  +import org.codehaus.plexus.util.IOUtil;
  +import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
   
   import java.io.File;
  +import java.io.IOException;
   import java.io.InputStreamReader;
   import java.util.List;
   import java.util.Set;
  @@ -52,18 +55,28 @@
           public Set retrieve( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories )
               throws ArtifactMetadataRetrievalException
           {
  -            MavenXpp3Reader reader = new MavenXpp3Reader();
               Model model = null;
  +            InputStreamReader r = null;
               try
               {
                   String scope = artifact.getArtifactId().substring( "scope-".length() );
                   String name = "/projects/scope/transitive-" + scope + "-dep.xml";
  -                model = reader.read( new InputStreamReader( getClass().getResourceAsStream( name ) ) );
  +                r = new InputStreamReader( getClass().getResourceAsStream( name ) );
  +                MavenXpp3Reader reader = new MavenXpp3Reader();
  +                model = reader.read( r );
               }
  -            catch ( Exception e )
  +            catch ( IOException e )
               {
                   throw new ArtifactMetadataRetrievalException( e );
               }
  +            catch ( XmlPullParserException e )
  +            {
  +                throw new ArtifactMetadataRetrievalException( e );
  +            }
  +            finally
  +            {
  +                IOUtil.close( r );
  +            }
               return artifactFactory.createArtifacts( model.getDependencies(), localRepository, artifact.getScope() );
           }
       }
  
  
  
  1.5       +1 -2      maven-components/maven-core/src/test/java/org/apache/maven/util/introspection/ReflectionValueExtractorTest.java
  
  Index: ReflectionValueExtractorTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/util/introspection/ReflectionValueExtractorTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ReflectionValueExtractorTest.java	28 Mar 2005 14:37:41 -0000	1.4
  +++ ReflectionValueExtractorTest.java	20 Apr 2005 16:41:36 -0000	1.5
  @@ -19,7 +19,6 @@
   import org.apache.maven.MavenTestCase;
   import org.apache.maven.model.Build;
   import org.apache.maven.project.MavenProject;
  -import org.apache.maven.project.MavenProjectBuilder;
   
   import java.io.File;
   import java.util.List;
  
  
  
  1.37      +1 -0      maven-components/maven-core/pom.xml
  
  Index: pom.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/pom.xml,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- pom.xml	19 Apr 2005 09:00:48 -0000	1.36
  +++ pom.xml	20 Apr 2005 16:41:36 -0000	1.37
  @@ -7,6 +7,7 @@
     <modelVersion>4.0.0</modelVersion>
     <artifactId>maven-core</artifactId>
     <name>Maven</name>
  +  <version>2.0-SNAPSHOT</version>
     <dependencies>
       <dependency>
         <groupId>org.apache.maven.wagon</groupId>
  
  
  
  1.4       +2 -2      maven-components/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/PluginUtilsTest.java
  
  Index: PluginUtilsTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/PluginUtilsTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PluginUtilsTest.java	13 Apr 2005 11:34:09 -0000	1.3
  +++ PluginUtilsTest.java	20 Apr 2005 16:41:36 -0000	1.4
  @@ -20,13 +20,13 @@
       public void testShouldTrimArtifactIdToFindPluginId()
       {
           Model model = new Model();
  -        model.setArtifactId( "test-artifactId-plugin" );
  +        model.setArtifactId( "maven-artifactId-plugin" );
   
           MavenProject project = new MavenProject( model );
   
           String pluginId = PluginDescriptor.getPluginIdFromArtifactId( project.getArtifactId() );
   
  -        System.out.println( pluginId );
  +        assertEquals( "artifactId", pluginId );
       }
   
       public void testShouldWriteDependencies()
  
  
  
  1.5       +3 -4      maven-components/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java
  
  Index: AssemblyMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/AssemblyMojo.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AssemblyMojo.java	18 Apr 2005 07:07:57 -0000	1.4
  +++ AssemblyMojo.java	20 Apr 2005 16:41:36 -0000	1.5
  @@ -110,15 +110,14 @@
               InputStream resourceAsStream = getClass().getResourceAsStream( "/assemblies/" + descriptorId + ".xml" );
               if ( resourceAsStream == null )
               {
  -                // TODO: better exception
  -                throw new Exception( "Descriptor with ID '" + descriptorId + "' not found" );
  +                throw new PluginExecutionException( "Descriptor with ID '" + descriptorId + "' not found" );
               }
               r = new InputStreamReader( resourceAsStream );
           }
           else
           {
               // TODO: better exception
  -            throw new Exception( "You must specify descriptor or descriptorId" );
  +            throw new PluginExecutionException( "You must specify descriptor or descriptorId" );
           }
   
           try
  
  
  
  1.29      +31 -29    maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
  
  Index: DefaultWagonManager.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- DefaultWagonManager.java	20 Apr 2005 01:55:24 -0000	1.28
  +++ DefaultWagonManager.java	20 Apr 2005 16:41:36 -0000	1.29
  @@ -79,12 +79,6 @@
           return wagon;
       }
   
  -    private void releaseWagon( Wagon wagon )
  -        throws ComponentLifecycleException
  -    {
  -        container.release( wagon );
  -    }
  -
       public void putArtifact( File source, Artifact artifact, ArtifactRepository repository )
           throws TransferFailedException
       {
  @@ -147,9 +141,6 @@
               wagon.connect( repository, getProxy( repository.getProtocol() ) );
   
               wagon.put( source, remotePath );
  -
  -            // TODO [BP]: put all disconnects in finally
  -            wagon.disconnect();
           }
           catch ( ConnectionException e )
           {
  @@ -169,14 +160,9 @@
           }
           finally
           {
  -            try
  -            {
  -                releaseWagon( wagon );
  -            }
  -            catch ( Exception e )
  -            {
  -                throw new TransferFailedException( "Unable to release wagon", e );
  -            }
  +            disconnectWagon( wagon );
  +
  +            releaseWagon( wagon );
           }
       }
   
  @@ -289,9 +275,6 @@
               wagon.connect( repository, getProxy( repository.getProtocol() ) );
   
               wagon.get( remotePath, temp );
  -
  -            // TODO [BP]: put all disconnects in finally
  -            wagon.disconnect();
           }
           catch ( ConnectionException e )
           {
  @@ -307,19 +290,14 @@
           }
           finally
           {
  -            try
  -            {
  -                releaseWagon( wagon );
  -            }
  -            catch ( Exception e )
  -            {
  -                throw new TransferFailedException( "Release of wagon failed: ", e );
  -            }
  +            disconnectWagon( wagon );
  +
  +            releaseWagon( wagon );
           }
   
           if ( !temp.exists() )
           {
  -            throw new TransferFailedException( "Downloaded file does not exist: " + temp );
  +            throw new ResourceDoesNotExistException( "Downloaded file does not exist: " + temp );
           }
   
           // The temporary file is named destination + ".tmp" and is done this
  @@ -347,6 +325,30 @@
           }
       }
   
  +    private void disconnectWagon( Wagon wagon )
  +    {
  +        try
  +        {
  +            wagon.disconnect();
  +        }
  +        catch ( ConnectionException e )
  +        {
  +            getLogger().error( "Problem disconnecting from wagon - ignoring: " + e.getMessage() );
  +        }
  +    }
  +
  +    private void releaseWagon( Wagon wagon )
  +    {
  +        try
  +        {
  +            container.release( wagon );
  +        }
  +        catch ( ComponentLifecycleException e )
  +        {
  +            getLogger().error( "Problem releasing wagon - ignoring: " + e.getMessage() );
  +        }
  +    }
  +
       private ProxyInfo getProxy( String protocol )
       {
           return (ProxyInfo) proxies.get( protocol );
  
  
  
  1.18      +8 -10     maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/SnapshotArtifactMetadata.java
  
  Index: SnapshotArtifactMetadata.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/SnapshotArtifactMetadata.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SnapshotArtifactMetadata.java	7 Apr 2005 02:28:24 -0000	1.17
  +++ SnapshotArtifactMetadata.java	20 Apr 2005 16:41:36 -0000	1.18
  @@ -147,16 +147,14 @@
               File destination = File.createTempFile( "maven-artifact", null );
               destination.deleteOnExit();
   
  -            try
  -            {
  -                wagonManager.getArtifactMetadata( snapshotMetadata, remoteRepository, destination );
  -
  -                snapshotMetadata.readFromFile( destination );
  -            }
  -            catch ( ResourceDoesNotExistException e )
  -            {
  -                // this just means that there is no snapshot version file, so we keep timestamp = null, build = 0
  -            }
  +            wagonManager.getArtifactMetadata( snapshotMetadata, remoteRepository, destination );
  +
  +            snapshotMetadata.readFromFile( destination );
  +        }
  +        catch ( ResourceDoesNotExistException e )
  +        {
  +            // No problem...
  +            // this just means that there is no snapshot version file, so we keep timestamp = null, build = 0
           }
           catch ( TransferFailedException e )
           {
  
  
  
  1.17      +2 -3      maven-components/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java
  
  Index: ResourcesMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugins/maven-resources-plugin/src/main/java/org/apache/maven/plugin/resources/ResourcesMojo.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ResourcesMojo.java	4 Apr 2005 21:32:52 -0000	1.16
  +++ ResourcesMojo.java	20 Apr 2005 16:41:36 -0000	1.17
  @@ -32,7 +32,6 @@
   import java.util.List;
   import java.util.Map;
   import java.util.TreeMap;
  -import java.util.Map.Entry;
   
   /**
    * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
  @@ -67,7 +66,7 @@
           {
               for ( Iterator i = getJarResources( resources ).entrySet().iterator(); i.hasNext(); )
               {
  -                Map.Entry entry = (Entry) i.next();
  +                Map.Entry entry = (Map.Entry) i.next();
                   String source = (String) entry.getKey();
                   String destination = (String) entry.getValue();
                   
  
  
  
  1.3       +1 -1      maven-components/maven-archetype/maven-archetypes/maven-archetype-mojo/src/main/resources/archetype-resources/src/main/java/MyMojo.java
  
  Index: MyMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-archetype/maven-archetypes/maven-archetype-mojo/src/main/resources/archetype-resources/src/main/java/MyMojo.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MyMojo.java	7 Apr 2005 15:42:46 -0000	1.2
  +++ MyMojo.java	20 Apr 2005 16:41:36 -0000	1.3
  @@ -64,7 +64,7 @@
           }
           catch ( IOException e )
           {
  -            throw new PluginExecutionException( "Error creating file " + touch );
  +            throw new PluginExecutionException( "Error creating file " + touch, e );
           }
           finally
           {
  
  
  
  1.8       +0 -2      maven-components/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/MarmaladeMojo.java
  
  Index: MarmaladeMojo.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/MarmaladeMojo.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MarmaladeMojo.java	8 Apr 2005 05:36:37 -0000	1.7
  +++ MarmaladeMojo.java	20 Apr 2005 16:41:36 -0000	1.8
  @@ -16,9 +16,7 @@
    * limitations under the License.
    */
   
  -import org.apache.maven.monitor.logging.Log;
   import org.apache.maven.plugin.AbstractPlugin;
  -import org.apache.maven.plugin.FailureResponse;
   import org.apache.maven.plugin.PluginExecutionRequest;
   import org.apache.maven.plugin.PluginExecutionResponse;
   import org.codehaus.marmalade.model.MarmaladeScript;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Mime
View raw message