maven-m2-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-core/src/main/java/org/apache/maven DefaultMaven.java
Date Tue, 01 Mar 2005 06:43:13 GMT
brett       2005/02/28 22:43:13

  Modified:    maven-plugin/src/main/java/org/apache/maven/plugin/descriptor
                        MojoDescriptor.java
               maven-core/src/main/java/org/apache/maven/cli MavenCli.java
               maven-core/src/main/java/org/apache/maven/execution
                        MavenSession.java
               maven-core/src/main/java/org/apache/maven/lifecycle/goal
                        MavenGoalExecutionContext.java
               maven-core/src/main/java/org/apache/maven/plugin
                        DefaultPluginManager.java
               maven-core/src/main/java/org/apache/maven/project
                        DefaultMavenProjectBuilder.java
                        MavenProjectBuilder.java
               maven-core/src/main/java/org/apache/maven DefaultMaven.java
  Log:
  clean up exceptions
  
  Revision  Changes    Path
  1.6       +0 -14     maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java
  
  Index: MojoDescriptor.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MojoDescriptor.java	27 Feb 2005 05:39:55 -0000	1.5
  +++ MojoDescriptor.java	1 Mar 2005 06:43:12 -0000	1.6
  @@ -226,18 +226,4 @@
       {
           this.executionStrategy = executionStrategy;
       }
  -
  -    public MojoDescriptor copy()
  -    {
  -        try
  -        {
  -            return (MojoDescriptor) this.clone();
  -        }
  -        catch ( Exception e )
  -        {
  -            // TODO: this needs better handling
  -        }
  -
  -        return null;
  -    }
   }
  
  
  
  1.12      +3 -2      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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MavenCli.java	25 Feb 2005 03:48:17 -0000	1.11
  +++ MavenCli.java	1 Mar 2005 06:43:12 -0000	1.12
  @@ -38,6 +38,7 @@
   
   import java.io.File;
   import java.io.FileInputStream;
  +import java.io.IOException;
   import java.util.Properties;
   
   /**
  @@ -320,7 +321,7 @@
           {
               mavenProperties.load( new FileInputStream( mavenPropertiesFile ) );
           }
  -        catch ( Exception e )
  +        catch ( IOException e )
           {
               // do nothing
           }
  
  
  
  1.3       +2 -1      maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
  
  Index: MavenSession.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MavenSession.java	25 Feb 2005 03:14:49 -0000	1.2
  +++ MavenSession.java	1 Mar 2005 06:43:12 -0000	1.3
  @@ -143,6 +143,7 @@
           return container.lookup( role, roleHint );
       }
   
  +    // TODO: can remove when phases are gone
       public void release( Object component )
       {
           if ( component != null )
  
  
  
  1.11      +1 -0      maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/MavenGoalExecutionContext.java
  
  Index: MavenGoalExecutionContext.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/MavenGoalExecutionContext.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- MavenGoalExecutionContext.java	25 Feb 2005 03:14:49 -0000	1.10
  +++ MavenGoalExecutionContext.java	1 Mar 2005 06:43:13 -0000	1.11
  @@ -89,6 +89,7 @@
           return session.lookup( role, hint );
       }
   
  +    // TODO: can remove when phases are gone
       public void release( Object component )
       {
           session.release( component );
  
  
  
  1.35      +29 -45    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.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- DefaultPluginManager.java	1 Mar 2005 04:03:24 -0000	1.34
  +++ DefaultPluginManager.java	1 Mar 2005 06:43:13 -0000	1.35
  @@ -233,15 +233,11 @@
   
           mavenProjectBuilder = (MavenProjectBuilder) container.lookup( MavenProjectBuilder.ROLE
);
   
  -        MavenMetadataSource metadataSource = new MavenMetadataSource( artifactResolver,
  -                                                                      mavenProjectBuilder
);
  +        MavenMetadataSource metadataSource = new MavenMetadataSource( artifactResolver,
mavenProjectBuilder );
   
  -        ( (ArtifactEnabledContainer) container ).addComponent( pluginArtifact,
  -                                                               artifactResolver,
  -                                                               remotePluginRepositories,
  -                                                               session.getLocalRepository(),
  -                                                               metadataSource,
  -                                                               artifactFilter );
  +        ( (ArtifactEnabledContainer) container ).addComponent( pluginArtifact, artifactResolver,
  +                                                               remotePluginRepositories,
session.getLocalRepository(),
  +                                                               metadataSource, artifactFilter
);
       }
   
       // ----------------------------------------------------------------------
  @@ -267,14 +263,21 @@
           MojoDescriptor mojoDescriptor = getMojoDescriptor( goalName );
           if ( mojoDescriptor == null )
           {
  -            throw new GoalExecutionException( "Unable to find goal: " + goalName );   
        
  +            throw new GoalExecutionException( "Unable to find goal: " + goalName );
           }
   
  -        if ( mojoDescriptor.requiresDependencyResolution() )
  +        try
           {
  -            resolveTransitiveDependencies( session );
  +            if ( mojoDescriptor.requiresDependencyResolution() )
  +            {
  +                resolveTransitiveDependencies( session );
   
  -            downloadDependencies( session );
  +                downloadDependencies( session );
  +            }
  +        }
  +        catch ( ArtifactResolutionException e )
  +        {
  +            throw new GoalExecutionException( "Unable to resolve required dependencies
for goal", e );
           }
   
           try
  @@ -434,10 +437,8 @@
       {
           StringBuffer message = new StringBuffer();
   
  -        message.append( "The '" + parameter.getName() ).
  -            append( "' parameter is required for the execution of the " ).
  -            append( mojo.getId() ).
  -            append( " mojo and cannot be null." );
  +        message.append( "The '" + parameter.getName() ).append( "' parameter is required
for the execution of the " ).append(
  +            mojo.getId() ).append( " mojo and cannot be null." );
   
           return message.toString();
       }
  @@ -456,17 +457,10 @@
       public void initialize()
           throws Exception
       {
  -        artifactFilter = new ExclusionSetFilter( new String[]
  -        {
  -            "maven-core",
  -            "maven-artifact",
  -            "maven-model",
  -            "maven-plugin",
  -            "plexus-container-api",
  -            "plexus-container-default",
  -            "plexus-artifact-container",
  -            "classworlds"
  -        } );
  +        artifactFilter = new ExclusionSetFilter( new String[]{"maven-core", "maven-artifact",
"maven-model",
  +                                                              "maven-plugin", "plexus-container-api",
  +                                                              "plexus-container-default",
"plexus-artifact-container",
  +                                                              "classworlds"} );
   
           // TODO: move this to be configurable from the Maven component
           remotePluginRepositories = new HashSet();
  @@ -480,26 +474,18 @@
       // ----------------------------------------------------------------------
   
       private void resolveTransitiveDependencies( MavenSession context )
  -        throws GoalExecutionException
  +        throws ArtifactResolutionException
       {
           MavenProject project = context.getProject();
   
  -        try
  -        {
  -            MavenMetadataSource sourceReader = new MavenMetadataSource( artifactResolver,
mavenProjectBuilder );
  +        MavenMetadataSource sourceReader = new MavenMetadataSource( artifactResolver, mavenProjectBuilder
);
   
  -            ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getArtifacts(),
  -                                                                                    context.getRemoteRepositories(),
  -                                                                                    context.getLocalRepository(),
  -                                                                                    sourceReader
);
  +        ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getArtifacts(),
  +                                                                                context.getRemoteRepositories(),
  +                                                                                context.getLocalRepository(),
  +                                                                                sourceReader
);
   
  -            project.getArtifacts().addAll( result.getArtifacts().values() );
  -
  -        }
  -        catch ( Exception e )
  -        {
  -            throw new GoalExecutionException( "Error resolving transitive dependencies.",
e );
  -        }
  +        project.getArtifacts().addAll( result.getArtifacts().values() );
       }
   
       // ----------------------------------------------------------------------
  @@ -515,9 +501,7 @@
               {
                   Artifact artifact = (Artifact) it.next();
   
  -                artifactResolver.resolve( artifact,
  -                                          context.getRemoteRepositories(),
  -                                          context.getLocalRepository() );
  +                artifactResolver.resolve( artifact, context.getRemoteRepositories(), context.getLocalRepository()
);
               }
           }
           catch ( ArtifactResolutionException e )
  
  
  
  1.33      +2 -1      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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- DefaultMavenProjectBuilder.java	23 Feb 2005 03:27:00 -0000	1.32
  +++ DefaultMavenProjectBuilder.java	1 Mar 2005 06:43:13 -0000	1.33
  @@ -41,6 +41,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.dag.CycleDetectedException;
   import org.codehaus.plexus.util.dag.DAG;
   import org.codehaus.plexus.util.dag.TopologicalSorter;
   
  @@ -285,7 +286,7 @@
        * </ul>
        */
       public List getSortedProjects( List projects )
  -        throws Exception
  +        throws CycleDetectedException
       {
           DAG dag = new DAG();
   
  
  
  
  1.8       +2 -1      maven-components/maven-core/src/main/java/org/apache/maven/project/MavenProjectBuilder.java
  
  Index: MavenProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/MavenProjectBuilder.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MavenProjectBuilder.java	25 Dec 2004 16:26:25 -0000	1.7
  +++ MavenProjectBuilder.java	1 Mar 2005 06:43:13 -0000	1.8
  @@ -18,6 +18,7 @@
    */
   
   import org.apache.maven.artifact.repository.ArtifactRepository;
  +import org.codehaus.plexus.util.dag.CycleDetectedException;
   
   import java.io.File;
   import java.util.List;
  @@ -35,5 +36,5 @@
       // take this out
   
       List getSortedProjects( List projects )
  -        throws Exception;
  +        throws CycleDetectedException;
   }
  
  
  
  1.20      +12 -2     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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DefaultMaven.java	25 Feb 2005 03:48:17 -0000	1.19
  +++ DefaultMaven.java	1 Mar 2005 06:43:13 -0000	1.20
  @@ -40,8 +40,10 @@
   import org.codehaus.plexus.i18n.I18N;
   import org.codehaus.plexus.logging.AbstractLogEnabled;
   import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
  +import org.codehaus.plexus.util.dag.CycleDetectedException;
   
   import java.io.File;
  +import java.io.IOException;
   import java.util.ArrayList;
   import java.util.Date;
   import java.util.Iterator;
  @@ -149,7 +151,15 @@
   
               projects = projectBuilder.getSortedProjects( projects );
           }
  -        catch ( Exception e )
  +        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 );
           }
  
  
  

Mime
View raw message