You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/04/20 06:16:11 UTC

cvs commit: maven-components/maven-mboot2 pom.xml

brett       2005/04/19 21:16:11

  Modified:    maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant
                        Pom.java
               maven-plugins/maven-clean-plugin/src/main/java/org/apache/maven/plugin/clean
                        CleanPlugin.java
               maven-core/src/main/java/org/apache/maven/cli MavenCli.java
               maven-core/src/main/java/org/apache/maven/lifecycle
                        DefaultLifecycleExecutor.java
                        LifecycleExecutor.java
               maven-core/src/main/java/org/apache/maven/plugin
                        DefaultPluginManager.java PluginManager.java
               maven-core/src/main/java/org/apache/maven/project
                        DefaultMavenProjectBuilder.java
               maven-core/src/main/java/org/apache/maven/settings
                        DefaultMavenSettingsBuilder.java
                        MavenSettingsBuilder.java
               maven-core/src/main/java/org/apache/maven DefaultMaven.java
               maven-core/src/main/resources/META-INF/plexus components.xml
                        plexus.xml
               maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin
                        AbstractGeneratorMojo.java BeanGeneratorMojo.java
               maven-mboot2 pom.xml
  Added:       maven-core/src/main/java/org/apache/maven/plugin
                        PluginManagerException.java
                        PluginNotFoundException.java
  Removed:     maven-core/src/main/java/org/apache/maven/plugin
                        PluginVersionNotConfiguredException.java
  Log:
  clean up exception handling
  
  Revision  Changes    Path
  1.2       +1 -2      maven-components/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/Pom.java
  
  Index: Pom.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/Pom.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Pom.java	18 Apr 2005 04:12:35 -0000	1.1
  +++ Pom.java	20 Apr 2005 04:16:10 -0000	1.2
  @@ -74,7 +74,6 @@
       }
   
       public void setFile( File file )
  -        throws Exception
       {
           this.file = file;
       }
  
  
  
  1.7       +3 -4      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CleanPlugin.java	21 Mar 2005 04:00:45 -0000	1.6
  +++ CleanPlugin.java	20 Apr 2005 04:16:10 -0000	1.7
  @@ -97,7 +97,6 @@
        * @param d the directory to delete
        */
       protected void removeDir( File d )
  -        throws Exception
       {
           String[] list = d.list();
           if ( list == null )
  @@ -124,7 +123,7 @@
   //                    }
   //                    else
   //                    {
  -                        getLog().info( message );
  +                    getLog().info( message );
   //                    }
                   }
               }
  @@ -140,7 +139,7 @@
   //            }
   //            else
   //            {
  -                getLog().info( message );
  +            getLog().info( message );
   //            }
           }
       }
  
  
  
  1.32      +200 -85   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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- MavenCli.java	18 Apr 2005 21:50:54 -0000	1.31
  +++ MavenCli.java	20 Apr 2005 04:16:10 -0000	1.32
  @@ -40,16 +40,21 @@
   import org.apache.maven.monitor.event.EventDispatcher;
   import org.apache.maven.monitor.logging.DefaultLog;
   import org.apache.maven.plugin.Plugin;
  -import org.apache.maven.settings.Settings;
  +import org.apache.maven.reactor.ReactorException;
   import org.apache.maven.settings.MavenSettingsBuilder;
   import org.apache.maven.settings.Profile;
  +import org.apache.maven.settings.Settings;
   import org.codehaus.classworlds.ClassWorld;
  +import org.codehaus.plexus.PlexusContainerException;
  +import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
   import org.codehaus.plexus.embed.ArtifactEnabledEmbedder;
   import org.codehaus.plexus.logging.Logger;
   import org.codehaus.plexus.logging.LoggerManager;
   import org.codehaus.plexus.util.FileUtils;
  +import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
   
   import java.io.File;
  +import java.io.IOException;
   import java.io.InputStreamReader;
   import java.net.URL;
   import java.util.Collections;
  @@ -67,7 +72,6 @@
       public static File userDir = new File( System.getProperty( "user.dir" ) );
   
       public static int main( String[] args, ClassWorld classWorld )
  -        throws Exception
       {
           // ----------------------------------------------------------------------
           // Setup the command line parser
  @@ -75,7 +79,17 @@
   
           CLIManager cliManager = new CLIManager();
   
  -        CommandLine commandLine = cliManager.parse( args );
  +        CommandLine commandLine;
  +        try
  +        {
  +            commandLine = cliManager.parse( args );
  +        }
  +        catch ( ParseException e )
  +        {
  +            System.err.println( "Unable to parse command line options: " + e.getMessage() );
  +            cliManager.displayHelp();
  +            return 1;
  +        }
   
           // ----------------------------------------------------------------------
           //
  @@ -95,6 +109,8 @@
   
           initializeSystemProperties( commandLine );
   
  +        boolean debug = commandLine.hasOption( CLIManager.DEBUG );
  +
           // ----------------------------------------------------------------------
           // Process particular command line options
           // ----------------------------------------------------------------------
  @@ -106,37 +122,11 @@
           }
           if ( commandLine.hasOption( CLIManager.VERSION ) )
           {
  -            // TODO: is there a beter way? Maybe read the manifest?
  +            showVersion();
   
  -            String version = "unknown";
  -
  -            for ( Enumeration e = MavenCli.class.getClassLoader().getResources( "/META-INF/maven/pom.xml" );
  -                  e.hasMoreElements(); )
  -            {
  -                URL resource = (URL) e.nextElement();
  -                if ( resource.getPath().indexOf( "maven-core" ) >= 0 )
  -                {
  -                    MavenXpp3Reader reader = new MavenXpp3Reader();
  -                    Model model = reader.read( new InputStreamReader( resource.openStream() ) );
  -                    version = model.getVersion();
  -                    break;
  -                }
  -            }
  -
  -            System.out.println( "Maven version: " + version );
               return 0;
           }
   
  -        // ----------------------------------------------------------------------
  -        // We will ultimately not require a flag to indicate the reactor as
  -        // we should take this from the execution context i.e. what the type
  -        // is stated as in the POM.
  -        // ----------------------------------------------------------------------
  -
  -        MavenExecutionRequest request = null;
  -
  -        File projectFile = new File( userDir, POMv4 );
  -
           EventDispatcher eventDispatcher = new DefaultEventDispatcher();
   
           // ----------------------------------------------------------------------
  @@ -146,67 +136,112 @@
   
           ArtifactEnabledEmbedder embedder = new ArtifactEnabledEmbedder();
   
  -        embedder.start( classWorld );
  -
  -        MavenSettingsBuilder settingsBuilder = (MavenSettingsBuilder) embedder.lookup( MavenSettingsBuilder.ROLE );
  -
  -        Settings settings = settingsBuilder.buildSettings();
  +        try
  +        {
  +            embedder.start( classWorld );
  +        }
  +        catch ( PlexusContainerException e )
  +        {
  +            showFatalError( "Unable to start the embedded plexus container", e, debug );
  +            return 1;
  +        }
   
  -        ArtifactRepositoryFactory artifactRepositoryFactory = (ArtifactRepositoryFactory) embedder.lookup(
  -            ArtifactRepositoryFactory.ROLE );
  +        Settings settings;
  +        try
  +        {
  +            MavenSettingsBuilder settingsBuilder = (MavenSettingsBuilder) embedder.lookup( MavenSettingsBuilder.ROLE );
   
  -        
  -        boolean snapshotPolicySet = false;
  -        if ( commandLine.hasOption( CLIManager.OFFLINE ) )
  +            settings = settingsBuilder.buildSettings();
  +        }
  +        catch ( IOException e )
           {
  -            settings.getActiveProfile().setOffline(true);
  -            
  -            // TODO: this will still check to download if the artifact does not exist locally, instead of failing as it should in offline mode
  -            artifactRepositoryFactory.setGlobalSnapshotPolicy( ArtifactRepository.SNAPSHOT_POLICY_NEVER );
  -            snapshotPolicySet = true;
  +            showFatalError( "Unable to read settings.xml", e, debug );
  +            return 1;
           }
  -        
  -        if ( !snapshotPolicySet && commandLine.hasOption( CLIManager.UPDATE_SNAPSHOTS ) )
  +        catch ( XmlPullParserException e )
           {
  -            artifactRepositoryFactory.setGlobalSnapshotPolicy( ArtifactRepository.SNAPSHOT_POLICY_ALWAYS );
  +            showFatalError( "Unable to read settings.xml", e, debug );
  +            return 1;
  +        }
  +        catch ( ComponentLookupException e )
  +        {
  +            showFatalError( "Unable to read settings.xml", e, debug );
  +            return 1;
           }
   
  -        ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) embedder.lookup(
  -            ArtifactRepositoryLayout.ROLE, "default" );
  +        List projectFiles = null;
  +        try
  +        {
  +            projectFiles = getProjectFiles( commandLine );
  +        }
  +        catch ( IOException e )
  +        {
  +            showFatalError( "Error locating project files for reactor execution", e, debug );
  +            return 1;
  +        }
   
  -        ArtifactRepository localRepository = getLocalRepository( settings, artifactRepositoryFactory, repositoryLayout );
  +        Maven maven = null;
  +        MavenExecutionRequest request = null;
  +        try
  +        {
  +            maven = createMavenInstance( embedder );
   
  -        if ( commandLine.hasOption( CLIManager.REACTOR ) )
  +            request = createRequest( projectFiles, embedder, commandLine, settings, eventDispatcher, debug );
  +        }
  +        catch ( ComponentLookupException e )
           {
  -            // TODO: should we now include the pom.xml in the current directory?
  -            String includes = System.getProperty( "maven.reactor.includes", "**/" + POMv4 );
  +            showFatalError( "Unable to configure the Maven application", e, debug );
  +            return 1;
  +        }
   
  -            String excludes = System.getProperty( "maven.reactor.excludes", POMv4 );
  +        MavenExecutionResponse response = null;
  +        try
  +        {
  +            response = maven.execute( request );
  +        }
  +        catch ( ReactorException e )
  +        {
  +            showFatalError( "Error executing Maven for a project", e, debug );
  +            return 1;
  +        }
   
  -            request = new DefaultMavenExecutionRequest( localRepository, settings, eventDispatcher,
  -                                                        commandLine.getArgList(), FileUtils.getFiles( userDir,
  -                                                                                                      includes,
  -                                                                                                      excludes ),
  -                                                        userDir.getPath() );
  +        if ( response != null && response.isExecutionFailure() )
  +        {
  +            return 1;
           }
           else
           {
  -            List files = Collections.EMPTY_LIST;
  -            if ( projectFile.exists() )
  -            {
  -                files = Collections.singletonList( projectFile );
  -            }
  -            request = new DefaultMavenExecutionRequest( localRepository, settings, eventDispatcher,
  -                                                        commandLine.getArgList(), files, userDir.getPath() );
  +            return 0;
  +        }
  +    }
   
  -            if ( commandLine.hasOption( CLIManager.NON_RECURSIVE ) )
  -            {
  -                request.setRecursive( false );
  -            }
  +    private static void showFatalError( String message, Exception e, boolean debug )
  +    {
  +        System.err.println( "FATAL ERROR: " + message );
  +        if ( debug )
  +        {
  +            e.printStackTrace();
  +        }
  +        else
  +        {
  +            System.err.println( "For more information, run with the -X flag" );
           }
  +    }
  +
  +    private static MavenExecutionRequest createRequest( List files, ArtifactEnabledEmbedder embedder,
  +                                                        CommandLine commandLine, Settings settings,
  +                                                        EventDispatcher eventDispatcher, boolean debug )
  +        throws ComponentLookupException
  +    {
  +        MavenExecutionRequest request = null;
  +
  +        ArtifactRepository localRepository = createLocalRepository( embedder, settings, commandLine );
  +
  +        request = new DefaultMavenExecutionRequest( localRepository, settings, eventDispatcher,
  +                                                    commandLine.getArgList(), files, userDir.getPath() );
   
           LoggerManager manager = (LoggerManager) embedder.lookup( LoggerManager.ROLE );
  -        if ( commandLine.hasOption( CLIManager.DEBUG ) )
  +        if ( debug )
           {
               manager.setThreshold( Logger.LEVEL_DEBUG );
           }
  @@ -220,25 +255,107 @@
               request.addEventMonitor( new DefaultEventMonitor( logger ) );
           }
   
  +        if ( commandLine.hasOption( CLIManager.NON_RECURSIVE ) )
  +        {
  +            request.setRecursive( false );
  +        }
  +        return request;
  +    }
  +
  +    private static List getProjectFiles( CommandLine commandLine )
  +        throws IOException
  +    {
  +        List files = Collections.EMPTY_LIST;
  +        if ( commandLine.hasOption( CLIManager.REACTOR ) )
  +        {
  +            // TODO: should we now include the pom.xml in the current directory?
  +            String includes = System.getProperty( "maven.reactor.includes", "**/" + POMv4 );
  +
  +            String excludes = System.getProperty( "maven.reactor.excludes", POMv4 );
  +
  +            files = FileUtils.getFiles( userDir, includes, excludes );
  +        }
  +        else
  +        {
  +            File projectFile = new File( userDir, POMv4 );
  +
  +            if ( projectFile.exists() )
  +            {
  +                files = Collections.singletonList( projectFile );
  +            }
  +        }
  +        return files;
  +    }
  +
  +    private static Maven createMavenInstance( ArtifactEnabledEmbedder embedder )
  +        throws ComponentLookupException
  +    {
           // TODO [BP]: doing this here as it is CLI specific, though it doesn't feel like the right place (likewise logger).
           WagonManager wagonManager = (WagonManager) embedder.lookup( WagonManager.ROLE );
           wagonManager.setDownloadMonitor( new ConsoleDownloadMonitor() );
   
  -        Maven maven = (Maven) embedder.lookup( Maven.ROLE );
  +        return (Maven) embedder.lookup( Maven.ROLE );
  +    }
   
  -        // ----------------------------------------------------------------------
  -        //
  -        // ----------------------------------------------------------------------
  +    private static ArtifactRepository createLocalRepository( ArtifactEnabledEmbedder embedder, Settings settings,
  +                                                             CommandLine commandLine )
  +        throws ComponentLookupException
  +    {
  +        ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) embedder.lookup(
  +            ArtifactRepositoryLayout.ROLE, "default" );
   
  -        MavenExecutionResponse response = maven.execute( request );
  +        ArtifactRepositoryFactory artifactRepositoryFactory = (ArtifactRepositoryFactory) embedder.lookup(
  +            ArtifactRepositoryFactory.ROLE );
   
  -        if ( response != null && response.isExecutionFailure() )
  +        ArtifactRepository localRepository = getLocalRepository( settings, artifactRepositoryFactory, repositoryLayout );
  +
  +        boolean snapshotPolicySet = false;
  +        if ( commandLine.hasOption( CLIManager.OFFLINE ) )
           {
  -            return 1;
  +            settings.getActiveProfile().setOffline( true );
  +
  +            // TODO: this will still check to download if the artifact does not exist locally, instead of failing as it should in offline mode
  +            artifactRepositoryFactory.setGlobalSnapshotPolicy( ArtifactRepository.SNAPSHOT_POLICY_NEVER );
  +            snapshotPolicySet = true;
           }
  -        else
  +
  +        if ( !snapshotPolicySet && commandLine.hasOption( CLIManager.UPDATE_SNAPSHOTS ) )
           {
  -            return 0;
  +            artifactRepositoryFactory.setGlobalSnapshotPolicy( ArtifactRepository.SNAPSHOT_POLICY_ALWAYS );
  +        }
  +        return localRepository;
  +    }
  +
  +    private static void showVersion()
  +    {
  +        // TODO: is there a beter way? Maybe read the manifest?
  +
  +        String version = "unknown";
  +
  +        try
  +        {
  +            for ( Enumeration e = MavenCli.class.getClassLoader().getResources( "/META-INF/maven/pom.xml" );
  +                  e.hasMoreElements(); )
  +            {
  +                URL resource = (URL) e.nextElement();
  +                if ( resource.getPath().indexOf( "maven-core" ) >= 0 )
  +                {
  +                    MavenXpp3Reader reader = new MavenXpp3Reader();
  +                    Model model = reader.read( new InputStreamReader( resource.openStream() ) );
  +                    version = model.getVersion();
  +                    break;
  +                }
  +            }
  +
  +            System.out.println( "Maven version: " + version );
  +        }
  +        catch ( IOException e )
  +        {
  +            System.err.println( "Unable determine version from JAR file: " + e.getMessage() );
  +        }
  +        catch ( XmlPullParserException e )
  +        {
  +            System.err.println( "Unable to parse POM in JAR file: " + e.getMessage() );
           }
       }
   
  @@ -355,10 +472,8 @@
       //
       // ----------------------------------------------------------------------
   
  -    protected static ArtifactRepository getLocalRepository( Settings settings,
  -                                                            ArtifactRepositoryFactory repoFactory,
  +    protected static ArtifactRepository getLocalRepository( Settings settings, ArtifactRepositoryFactory repoFactory,
                                                               ArtifactRepositoryLayout repositoryLayout )
  -        throws Exception
       {
           Profile profile = settings.getActiveProfile();
   
  
  
  
  1.36      +32 -13    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.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- DefaultLifecycleExecutor.java	18 Apr 2005 21:50:55 -0000	1.35
  +++ DefaultLifecycleExecutor.java	20 Apr 2005 04:16:10 -0000	1.36
  @@ -18,6 +18,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.ArtifactResolver;
   import org.apache.maven.execution.MavenExecutionResponse;
   import org.apache.maven.execution.MavenSession;
  @@ -28,6 +29,8 @@
   import org.apache.maven.monitor.event.MavenEvents;
   import org.apache.maven.plugin.PluginExecutionException;
   import org.apache.maven.plugin.PluginManager;
  +import org.apache.maven.plugin.PluginManagerException;
  +import org.apache.maven.plugin.PluginNotFoundException;
   import org.apache.maven.plugin.descriptor.MojoDescriptor;
   import org.apache.maven.plugin.descriptor.PluginDescriptor;
   import org.apache.maven.project.MavenProject;
  @@ -139,9 +142,13 @@
           {
               response.setException( e );
           }
  -        catch ( Exception e )
  +        catch ( PluginNotFoundException e )
           {
  -            throw new LifecycleExecutionException( "Error during lifecycle execution", e );
  +            response.setException( e );
  +        }
  +        catch ( ArtifactHandlerNotFoundException e )
  +        {
  +            response.setException( e );
           }
           finally
           {
  @@ -206,9 +213,8 @@
           return plugin;
       }
   
  -    // TODO: don't throw Exception
       private void processPluginConfiguration( MavenProject project, MavenSession mavenSession, Map phaseMap )
  -        throws Exception
  +        throws LifecycleExecutionException, PluginNotFoundException
       {
           for ( Iterator i = project.getPlugins().iterator(); i.hasNext(); )
           {
  @@ -224,16 +230,22 @@
        * to execute for that given phase.
        *
        * @param session
  -     * @throws Exception
        */
       private void processPluginPhases( Plugin plugin, MavenSession session, Map phaseMap )
  -        throws Exception
  +        throws LifecycleExecutionException, PluginNotFoundException
       {
           String groupId = plugin.getGroupId();
   
           String artifactId = plugin.getArtifactId();
   
  -        pluginManager.verifyPlugin( groupId, artifactId, session );
  +        try
  +        {
  +            pluginManager.verifyPlugin( groupId, artifactId, session );
  +        }
  +        catch ( PluginManagerException e )
  +        {
  +            throw new LifecycleExecutionException( "Internal error in the plugin manager", e );
  +        }
   
           PluginDescriptor pluginDescriptor = pluginManager.getPluginDescriptor( groupId, artifactId );
   
  @@ -288,7 +300,7 @@
        */
       private void configureMojo( MojoDescriptor mojoDescriptor, Map phaseMap, Settings settings )
       {
  -        if( settings.getActiveProfile().isOffline() && mojoDescriptor.requiresOnline() )
  +        if ( settings.getActiveProfile().isOffline() && mojoDescriptor.requiresOnline() )
           {
               String goal = mojoDescriptor.getGoal();
               getLogger().warn( goal + " requires online mode, but maven is currently offline. Disabling " + goal + "." );
  @@ -305,7 +317,7 @@
       }
   
       private void processGoalChain( String task, MavenSession session, Map phaseMap )
  -        throws Exception
  +        throws LifecycleExecutionException, PluginNotFoundException
       {
           if ( phaseMap.containsKey( task ) )
           {
  @@ -337,7 +349,7 @@
       }
   
       private void verifyMojoPhase( String task, MavenSession session, Map phaseMap )
  -        throws Exception
  +        throws LifecycleExecutionException, PluginNotFoundException
       {
           MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( task );
   
  @@ -356,7 +368,14 @@
   
               injectHandlerPluginConfiguration( session.getProject(), groupId, artifactId );
   
  -            pluginManager.verifyPluginForGoal( task, session );
  +            try
  +            {
  +                pluginManager.verifyPluginForGoal( task, session );
  +            }
  +            catch ( PluginManagerException e )
  +            {
  +                throw new LifecycleExecutionException( "Internal error in the plugin manager", e );
  +            }
   
               mojoDescriptor = pluginManager.getMojoDescriptor( task );
   
  @@ -370,7 +389,7 @@
       }
   
       private void executePhase( String phase, MavenSession session, Map phaseMap )
  -        throws PluginExecutionException
  +        throws PluginExecutionException, PluginNotFoundException
       {
           // only execute up to the given phase
           int index = phases.indexOf( phaseMap.get( phase ) );
  @@ -411,7 +430,7 @@
       }
   
       protected void executeMojo( String id, MavenSession session )
  -        throws PluginExecutionException
  +        throws PluginExecutionException, PluginNotFoundException
       {
           // ----------------------------------------------------------------------
           // We have something of the form <pluginId>:<mojoId>, so this might be
  
  
  
  1.5       +1 -1      maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
  
  
  
  
  1.83      +72 -44    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.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- DefaultPluginManager.java	18 Apr 2005 21:50:55 -0000	1.82
  +++ DefaultPluginManager.java	20 Apr 2005 04:16:10 -0000	1.83
  @@ -38,6 +38,7 @@
   import org.apache.maven.project.path.PathTranslator;
   import org.apache.maven.settings.MavenSettingsBuilder;
   import org.codehaus.plexus.ArtifactEnabledContainer;
  +import org.codehaus.plexus.ArtifactEnabledContainerException;
   import org.codehaus.plexus.PlexusConstants;
   import org.codehaus.plexus.PlexusContainer;
   import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
  @@ -47,6 +48,7 @@
   import org.codehaus.plexus.component.discovery.ComponentDiscoveryEvent;
   import org.codehaus.plexus.component.discovery.ComponentDiscoveryListener;
   import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
  +import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
   import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
   import org.codehaus.plexus.configuration.PlexusConfiguration;
   import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
  @@ -93,6 +95,8 @@
   
       protected ComponentConfigurator configurator;
   
  +    private ArtifactFactory artifactFactory;
  +
       public DefaultPluginManager()
       {
           mojoDescriptors = new HashMap();
  @@ -194,80 +198,91 @@
           return pluginDescriptors.containsKey( PluginDescriptor.constructPluginKey( groupId, artifactId ) );
       }
   
  -    // TODO: don't throw Exception
       public void verifyPluginForGoal( String goalName, MavenSession session )
  -        throws Exception
  +        throws PluginNotFoundException, PluginManagerException
       {
           String pluginId = PluginDescriptor.getPluginIdFromGoal( goalName );
   
           verifyPlugin( PluginDescriptor.getDefaultPluginGroupId(), pluginId, session );
       }
   
  -    // TODO: don't throw Exception
       public void verifyPlugin( String groupId, String artifactId, MavenSession session )
  -        throws Exception
  +        throws PluginNotFoundException, PluginManagerException
       {
           if ( !isPluginInstalled( groupId, artifactId ) )
           {
  -            ArtifactFactory artifactFactory = null;
  -            try
  -            {
  -                MavenProject project = session.getProject();
  +            MavenProject project = session.getProject();
   
  -                org.apache.maven.model.Plugin pluginConfig = null;
  +            org.apache.maven.model.Plugin pluginConfig = null;
   
  -                for ( Iterator it = project.getPlugins().iterator(); it.hasNext(); )
  -                {
  -                    org.apache.maven.model.Plugin plugin = (org.apache.maven.model.Plugin) it.next();
  +            for ( Iterator it = project.getPlugins().iterator(); it.hasNext(); )
  +            {
  +                org.apache.maven.model.Plugin plugin = (org.apache.maven.model.Plugin) it.next();
   
  -                    if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
  -                    {
  -                        pluginConfig = plugin;
  +                if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
  +                {
  +                    pluginConfig = plugin;
   
  -                        break;
  -                    }
  +                    break;
                   }
  +            }
   
  -                String version = null;
  +            String version = null;
   
  -                if ( pluginConfig != null )
  +            if ( pluginConfig != null )
  +            {
  +                if ( StringUtils.isEmpty( pluginConfig.getVersion() ) )
                   {
  -                    if ( StringUtils.isEmpty( pluginConfig.getVersion() ) )
  -                    {
  -                        throw new PluginVersionNotConfiguredException( groupId, artifactId );
  -                    }
  -                    else
  -                    {
  -                        version = pluginConfig.getVersion();
  -                    }
  +                    // The model/project builder should have validated this already
  +                    String message = "The maven plugin with groupId: '" + groupId + "' and artifactId: '" + artifactId +
  +                        "' which was configured for use in this project does not have a version associated with it.";
  +                    throw new IllegalStateException( message );
                   }
  -
  -                // TODO: Default over to a sensible value (is 1.0-SNAPSHOT right?) Hardcoging of group ID also
  -                if ( StringUtils.isEmpty( version ) )
  +                else
                   {
  -                    version = "1.0-SNAPSHOT";
  +                    version = pluginConfig.getVersion();
                   }
  +            }
   
  -                artifactFactory = (ArtifactFactory) container.lookup( ArtifactFactory.ROLE );
  -
  +            try
  +            {
                   Artifact pluginArtifact = artifactFactory.createArtifact( groupId, artifactId, version, null,
                                                                             MAVEN_PLUGIN, null );
   
                   addPlugin( pluginArtifact, session );
               }
  +            catch ( ArtifactEnabledContainerException e )
  +            {
  +                throw new PluginManagerException( "Error occurred in the artifact container attempting to download plugin " +
  +                                                  groupId + ":" + artifactId, e );
  +            }
  +            catch ( ArtifactResolutionException e )
  +            {
  +                throw new PluginNotFoundException( groupId, artifactId, version, e );
  +            }
  +            catch ( ComponentLookupException e )
  +            {
  +                throw new PluginManagerException( "Internal configuration error while retrieving " + groupId + ":" + artifactId, e );
  +            }
               finally
               {
                   if ( artifactFactory != null )
                   {
  -                    container.release( artifactFactory );
  +                    try
  +                    {
  +                        container.release( artifactFactory );
  +                    }
  +                    catch ( ComponentLifecycleException e )
  +                    {
  +                        getLogger().error( "Error releasing component - ignoring", e );
  +                    }
                   }
               }
           }
       }
   
  -    // TODO: don't throw Exception
       protected void addPlugin( Artifact pluginArtifact, MavenSession session )
  -        throws Exception
  +        throws ArtifactEnabledContainerException, ArtifactResolutionException, ComponentLookupException
       {
           ArtifactResolver artifactResolver = null;
           MavenProjectBuilder mavenProjectBuilder = null;
  @@ -287,14 +302,27 @@
           }
           finally
           {
  -            // TODO: watch out for the exceptions being thrown
               if ( artifactResolver != null )
               {
  -                container.release( artifactResolver );
  +                try
  +                {
  +                    container.release( artifactResolver );
  +                }
  +                catch ( ComponentLifecycleException e )
  +                {
  +                    getLogger().error( "Error releasing component - ignoring", e );
  +                }
               }
               if ( mavenProjectBuilder != null )
               {
  -                container.release( mavenProjectBuilder );
  +                try
  +                {
  +                    container.release( mavenProjectBuilder );
  +                }
  +                catch ( ComponentLifecycleException e )
  +                {
  +                    getLogger().error( "Error releasing component - ignoring", e );
  +                }
               }
           }
       }
  @@ -304,7 +332,7 @@
       // ----------------------------------------------------------------------
   
       public void executeMojo( MavenSession session, String goalName )
  -        throws PluginExecutionException
  +        throws PluginExecutionException, PluginNotFoundException
       {
           try
           {
  @@ -400,7 +428,7 @@
               {
                   if ( newMojoTechnique )
                   {
  -                    Map map = getPluginConfigurationFromExpressions( mojoDescriptor, configuration, session,
  +                    Map map = getPluginConfigurationFromExpressions( mojoDescriptor, configuration,
                                                                        expressionEvaluator );
   
                       populatePluginFields( plugin, configuration, map, expressionEvaluator );
  @@ -409,7 +437,7 @@
                   {
                       getLogger().warn( "WARNING: The mojo " + mojoDescriptor.getId() + " is using the OLD API" );
   
  -                    Map map = getPluginConfigurationFromExpressions( mojoDescriptor, configuration, session,
  +                    Map map = getPluginConfigurationFromExpressions( mojoDescriptor, configuration,
                                                                        expressionEvaluator );
   
                       request = createPluginRequest( configuration, map );
  @@ -641,7 +669,7 @@
        * @deprecated
        */
       private Map getPluginConfigurationFromExpressions( MojoDescriptor goal, PlexusConfiguration configuration,
  -                                                       MavenSession session, ExpressionEvaluator expressionEvaluator )
  +                                                       ExpressionEvaluator expressionEvaluator )
           throws ExpressionEvaluationException, PluginConfigurationException
       {
           List parameters = goal.getParameters();
  @@ -742,7 +770,7 @@
           ArtifactFilter filter = new ScopeArtifactFilter( scope );
   
           boolean systemOnline = !context.getSettings().getActiveProfile().isOffline();
  -        
  +
           ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getArtifacts(),
                                                                                   context.getRemoteRepositories(),
                                                                                   context.getLocalRepository(),
  
  
  
  1.19      +4 -6      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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- PluginManager.java	20 Mar 2005 23:22:01 -0000	1.18
  +++ PluginManager.java	20 Apr 2005 04:16:11 -0000	1.19
  @@ -30,17 +30,15 @@
       String ROLE = PluginManager.class.getName();
   
       void executeMojo( MavenSession session, String goalName )
  -        throws PluginExecutionException;
  +        throws PluginExecutionException, PluginNotFoundException;
   
       MojoDescriptor getMojoDescriptor( String goalId );
   
  -    // TODO: don't throw Exception
       void verifyPluginForGoal( String goalName, MavenSession session )
  -        throws Exception;
  +        throws PluginNotFoundException, PluginManagerException;
   
  -    // TODO: don't throw Exception
       void verifyPlugin( String groupId, String artifactId, MavenSession session )
  -        throws Exception;
  +        throws PluginNotFoundException, PluginManagerException;
   
       PluginDescriptor getPluginDescriptor( String groupId, String artifactId );
   }
  \ No newline at end of file
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java
  
  Index: PluginManagerException.java
  ===================================================================
  package org.apache.maven.plugin;
  
  /*
   * Copyright 2001-2005 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  /**
   * Exception in the plugin manager.
   *
   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
   * @version $Id: PluginManagerException.java,v 1.1 2005/04/20 04:16:11 brett Exp $
   */
  public class PluginManagerException
      extends Exception
  {
      public PluginManagerException( String message, Exception e )
      {
      }
  }
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/plugin/PluginNotFoundException.java
  
  Index: PluginNotFoundException.java
  ===================================================================
  package org.apache.maven.plugin;
  
  /*
   * Copyright 2001-2005 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  import org.apache.maven.artifact.resolver.ArtifactResolutionException;
  
  /**
   * Exception occurring trying to resolve a plugin.
   *
   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
   * @version $Id: PluginNotFoundException.java,v 1.1 2005/04/20 04:16:11 brett Exp $
   */
  public class PluginNotFoundException
      extends Throwable
  {
      public PluginNotFoundException( String groupId, String artifactId, String version, ArtifactResolutionException e )
      {
          super(
              "Plugin could not found in any remote repositories: [" + groupId + ":" + artifactId + ":" + version + "]",
              e );
      }
  }
  
  
  
  1.68      +42 -68    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.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- DefaultMavenProjectBuilder.java	19 Apr 2005 09:00:47 -0000	1.67
  +++ DefaultMavenProjectBuilder.java	20 Apr 2005 04:16:11 -0000	1.68
  @@ -127,16 +127,7 @@
           // Always cache files in the source tree over those in the repository
           modelCache.put( createCacheKey( model.getGroupId(), model.getArtifactId(), model.getVersion() ), model );
   
  -        Settings settings = null;
  -
  -        try
  -        {
  -            settings = mavenSettingsBuilder.buildSettings();
  -        }
  -        catch ( Exception e )
  -        {
  -            throw new ProjectBuildingException( "Cannot read settings.", e );
  -        }
  +        Settings settings = readSettings();
   
           boolean systemOnline = !settings.getActiveProfile().isOffline();
   
  @@ -156,8 +147,13 @@
           return project;
       }
   
  -    public MavenProject buildFromRepository( Artifact artifact, List remoteArtifactRepositories,
  -                                             ArtifactRepository localRepository )
  +    /**
  +     * @return
  +     * @throws ProjectBuildingException
  +     * @todo shouldn't be re-reading all the time - perhaps cache, but check a timestamp so you can detect and reload on
  +     * changes in a long running process
  +     */
  +    private Settings readSettings()
           throws ProjectBuildingException
       {
           Settings settings = null;
  @@ -170,6 +166,14 @@
           {
               throw new ProjectBuildingException( "Cannot read settings.", e );
           }
  +        return settings;
  +    }
  +
  +    public MavenProject buildFromRepository( Artifact artifact, List remoteArtifactRepositories,
  +                                             ArtifactRepository localRepository )
  +        throws ProjectBuildingException
  +    {
  +        Settings settings = readSettings();
   
           Model model = findModelFromRepository( artifact, remoteArtifactRepositories, localRepository );
   
  @@ -304,16 +308,6 @@
   
           if ( resolveDependencies )
           {
  -            Settings settings;
  -            try
  -            {
  -                settings = mavenSettingsBuilder.buildSettings();
  -            }
  -            catch ( Exception e )
  -            {
  -                throw new ProjectBuildingException( "Cannot read settings.", e );
  -            }
  -
               MavenMetadataSource sourceReader = new MavenMetadataSource( artifactResolver, this );
   
               ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getArtifacts(),
  @@ -385,16 +379,7 @@
       private List buildArtifactRepositories( List repositories )
           throws ProjectBuildingException
       {
  -        Settings settings = null;
  -
  -        try
  -        {
  -            settings = mavenSettingsBuilder.buildSettings();
  -        }
  -        catch ( Exception e )
  -        {
  -            throw new ProjectBuildingException( "Cannot read settings.", e );
  -        }
  +        Settings settings = readSettings();
   
           List repos = new ArrayList();
   
  @@ -402,20 +387,7 @@
           {
               Repository mavenRepo = (Repository) i.next();
   
  -            String layout = mavenRepo.getLayout();
  -
  -            ArtifactRepositoryLayout remoteRepoLayout = null;
  -            try
  -            {
  -                remoteRepoLayout =
  -                    (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, layout );
  -            }
  -            catch ( ComponentLookupException e )
  -            {
  -                throw new ProjectBuildingException( "Cannot find layout implementation corresponding to: \'" + layout +
  -                                                    "\' for remote repository with id: \'" + mavenRepo.getId() + "\'.",
  -                                                    e );
  -            }
  +            ArtifactRepositoryLayout remoteRepoLayout = getRepositoryLayout( mavenRepo );
   
               ArtifactRepository artifactRepo = artifactRepositoryFactory.createArtifactRepository( mavenRepo, settings,
                                                                                                     remoteRepoLayout );
  @@ -429,30 +401,17 @@
       }
   
       private List buildPluginRepositories( List pluginRepositories )
  -        throws Exception
  +        throws ProjectBuildingException
       {
           List remotePluginRepositories = new ArrayList();
   
  -        Settings settings = mavenSettingsBuilder.buildSettings();
  +        Settings settings = readSettings();
   
           for ( Iterator it = pluginRepositories.iterator(); it.hasNext(); )
           {
               Repository mavenRepo = (Repository) it.next();
   
  -            String layout = mavenRepo.getLayout();
  -
  -            ArtifactRepositoryLayout repositoryLayout = null;
  -            try
  -            {
  -                repositoryLayout =
  -                    (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, layout );
  -            }
  -            catch ( ComponentLookupException e )
  -            {
  -                throw new ProjectBuildingException( "Cannot find layout implementation corresponding to: \'" + layout +
  -                                                    "\' for remote repository with id: \'" + mavenRepo.getId() + "\'.",
  -                                                    e );
  -            }
  +            ArtifactRepositoryLayout repositoryLayout = getRepositoryLayout( mavenRepo );
   
               ArtifactRepository pluginRepository = artifactRepositoryFactory.createArtifactRepository( mavenRepo,
                                                                                                         settings,
  @@ -465,20 +424,35 @@
           return remotePluginRepositories;
       }
   
  +    private ArtifactRepositoryLayout getRepositoryLayout( Repository mavenRepo )
  +        throws ProjectBuildingException
  +    {
  +        String layout = mavenRepo.getLayout();
  +
  +        ArtifactRepositoryLayout repositoryLayout = null;
  +        try
  +        {
  +            repositoryLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, layout );
  +        }
  +        catch ( ComponentLookupException e )
  +        {
  +            throw new ProjectBuildingException( "Cannot find layout implementation corresponding to: \'" + layout +
  +                                                "\' for remote repository with id: \'" + mavenRepo.getId() + "\'.", e );
  +        }
  +        return repositoryLayout;
  +    }
  +
       private ArtifactRepository buildDistributionManagementRepository( Repository dmRepo )
  -        throws Exception
  +        throws ProjectBuildingException
       {
           if ( dmRepo == null )
           {
               return null;
           }
   
  -        Settings settings = mavenSettingsBuilder.buildSettings();
  -
  -        String repoLayoutId = dmRepo.getLayout();
  +        Settings settings = readSettings();
   
  -        ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) container.lookup(
  -            ArtifactRepositoryLayout.ROLE, repoLayoutId );
  +        ArtifactRepositoryLayout repositoryLayout = getRepositoryLayout( dmRepo );
   
           ArtifactRepository dmArtifactRepository = artifactRepositoryFactory.createArtifactRepository( dmRepo, settings,
                                                                                                         repositoryLayout );
  
  
  
  1.7       +10 -3     maven-components/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
  
  Index: DefaultMavenSettingsBuilder.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultMavenSettingsBuilder.java	19 Apr 2005 09:00:48 -0000	1.6
  +++ DefaultMavenSettingsBuilder.java	20 Apr 2005 04:16:11 -0000	1.7
  @@ -21,9 +21,12 @@
   import org.codehaus.plexus.logging.AbstractLogEnabled;
   import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
   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.IOException;
   
   /**
    * @author jdcasey
  @@ -57,9 +60,8 @@
       // MavenSettingsBuilder Implementation
       // ----------------------------------------------------------------------
   
  -    // TODO: don't throw Exception.
       public Settings buildSettings()
  -        throws Exception
  +        throws IOException, XmlPullParserException
       {
           Settings settings = null;
   
  @@ -74,6 +76,11 @@
   
                   settings = modelReader.read( reader );
               }
  +            catch ( FileNotFoundException e )
  +            {
  +                // Not possible - just ignore
  +                getLogger().warn( "Settings file disappeared - ignoring", e );
  +            }
               finally
               {
                   IOUtil.close( reader );
  
  
  
  1.4       +6 -3      maven-components/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java
  
  Index: MavenSettingsBuilder.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MavenSettingsBuilder.java	18 Apr 2005 21:50:54 -0000	1.3
  +++ MavenSettingsBuilder.java	20 Apr 2005 04:16:11 -0000	1.4
  @@ -1,5 +1,9 @@
   package org.apache.maven.settings;
   
  +import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
  +
  +import java.io.IOException;
  +
   /*
    * Copyright 2001-2005 The Apache Software Foundation.
    *
  @@ -24,7 +28,6 @@
   {
       String ROLE = MavenSettingsBuilder.class.getName();
   
  -    // TODO: Don't throw Exception.
       Settings buildSettings()
  -        throws Exception;
  +        throws IOException, XmlPullParserException;
   }
  
  
  
  1.47      +28 -17    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.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- DefaultMaven.java	18 Apr 2005 21:50:55 -0000	1.46
  +++ DefaultMaven.java	20 Apr 2005 04:16:11 -0000	1.47
  @@ -23,6 +23,7 @@
   import org.apache.maven.execution.MavenExecutionRequest;
   import org.apache.maven.execution.MavenExecutionResponse;
   import org.apache.maven.execution.MavenSession;
  +import org.apache.maven.lifecycle.LifecycleExecutionException;
   import org.apache.maven.lifecycle.LifecycleExecutor;
   import org.apache.maven.monitor.event.EventDispatcher;
   import org.apache.maven.monitor.event.MavenEvents;
  @@ -32,8 +33,8 @@
   import org.apache.maven.project.MavenProjectBuilder;
   import org.apache.maven.project.ProjectBuildingException;
   import org.apache.maven.reactor.ReactorException;
  -import org.apache.maven.settings.Settings;
   import org.apache.maven.settings.Proxy;
  +import org.apache.maven.settings.Settings;
   import org.codehaus.plexus.PlexusConstants;
   import org.codehaus.plexus.PlexusContainer;
   import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
  @@ -76,21 +77,22 @@
       protected PlexusContainer container;
   
       protected ArtifactRepositoryFactory artifactRepositoryFactory;
  -    
  +
       protected WagonManager wagonManager;
   
       // ----------------------------------------------------------------------
       // Project execution
       // ----------------------------------------------------------------------
   
  -    public MavenExecutionResponse execute( MavenExecutionRequest request ) throws ReactorException
  +    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() )
  +
  +        if ( request.getSettings().getActiveProfile().isOffline() )
           {
               getLogger().info( "Maven is running in offline mode." );
           }
  @@ -100,7 +102,7 @@
   
           // TODO: goals are outer loop
           dispatcher.dispatchStart( event, request.getBaseDirectory() );
  -        
  +
           try
           {
               List projects;
  @@ -201,11 +203,19 @@
       }
   
       private MavenExecutionResponse processProject( MavenExecutionRequest request, MavenProject project,
  -                                                  EventDispatcher dispatcher, List goals ) throws Exception
  +                                                   EventDispatcher dispatcher, List goals )
  +        throws LifecycleExecutionException
       {
           MavenSession session = createSession( request, project );
   
  -        resolveParameters( request );
  +        try
  +        {
  +            resolveParameters( request );
  +        }
  +        catch ( ComponentLookupException e )
  +        {
  +            throw new LifecycleExecutionException( "Unable to configure Maven for execution", e );
  +        }
   
           // !! This is ripe for refactoring to an aspect.
           // Event monitoring.
  @@ -221,7 +231,7 @@
   
               dispatcher.dispatchEnd( event, project.getId() );
           }
  -        catch ( Exception e )
  +        catch ( LifecycleExecutionException e )
           {
               dispatcher.dispatchError( event, project.getId(), e );
               throw e;
  @@ -261,7 +271,8 @@
           return response;
       }
   
  -    public MavenProject getProject( File pom, ArtifactRepository localRepository ) throws ProjectBuildingException
  +    public MavenProject getProject( File pom, ArtifactRepository localRepository )
  +        throws ProjectBuildingException
       {
           if ( pom.exists() )
           {
  @@ -293,11 +304,11 @@
       /**
        * @todo [BP] this might not be required if there is a better way to pass
        * them in. It doesn't feel quite right.
  -     * 
        * @todo [JC] we should at least provide a mapping of protocol-to-proxy for
        * the wagons, shouldn't we?
        */
  -    private void resolveParameters( MavenExecutionRequest request ) throws ComponentLookupException
  +    private void resolveParameters( MavenExecutionRequest request )
  +        throws ComponentLookupException
       {
           WagonManager wagonManager = (WagonManager) container.lookup( WagonManager.ROLE );
   
  @@ -317,7 +328,8 @@
       // Lifecylce Management
       // ----------------------------------------------------------------------
   
  -    public void contextualize( Context context ) throws ContextException
  +    public void contextualize( Context context )
  +        throws ContextException
       {
           container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
       }
  @@ -394,9 +406,8 @@
   
           Runtime r = Runtime.getRuntime();
   
  -        getLogger().info(
  -                          "Final Memory: " + ( ( r.totalMemory() - r.freeMemory() ) / mb ) + "M/"
  -                              + ( r.totalMemory() / mb ) + "M" );
  +        getLogger().info( "Final Memory: " + ( ( r.totalMemory() - r.freeMemory() ) / mb ) + "M/" +
  +                          ( r.totalMemory() / mb ) + "M" );
       }
   
       protected void line()
  
  
  
  1.29      +7 -4      maven-components/maven-core/src/main/resources/META-INF/plexus/components.xml
  
  Index: components.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/resources/META-INF/plexus/components.xml,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- components.xml	18 Apr 2005 07:08:21 -0000	1.28
  +++ components.xml	20 Apr 2005 04:16:11 -0000	1.29
  @@ -117,10 +117,6 @@
        |
        |
        -->
  -    <component>
  -      <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
  -      <implementation>org.apache.maven.artifact.factory.DefaultArtifactFactory</implementation>
  -    </component>
   
       <!--
        |
  @@ -237,6 +233,13 @@
        | I realize this is duplicated but allows the project builder to work by itself
        -->
       <component>
  +      <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
  +      <implementation>org.apache.maven.artifact.factory.DefaultArtifactFactory</implementation>
  +    </component>
  +    <!-- ********************* FIXME *******************************************
  +     | I realize this is duplicated but allows the project builder to work by itself
  +     -->
  +    <component>
         <role>org.apache.maven.project.path.PathTranslator</role>
         <implementation>org.apache.maven.project.path.DefaultPathTranslator</implementation>
       </component>
  
  
  
  1.10      +7 -0      maven-components/maven-core/src/main/resources/META-INF/plexus/plexus.xml
  
  Index: plexus.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/resources/META-INF/plexus/plexus.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- plexus.xml	29 Mar 2005 17:06:30 -0000	1.9
  +++ plexus.xml	20 Apr 2005 04:16:11 -0000	1.10
  @@ -33,6 +33,9 @@
           <requirement>
             <role>org.codehaus.plexus.component.configurator.ComponentConfigurator</role>
           </requirement>
  +        <requirement>
  +          <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
  +        </requirement>
         </requirements>
       </component>
       <component>
  @@ -50,5 +53,9 @@
           <settingsPath>${user.home}/.m2/settings.xml</settingsPath>
         </configuration>
       </component>
  +    <component>
  +      <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
  +      <implementation>org.apache.maven.artifact.factory.DefaultArtifactFactory</implementation>
  +    </component>
     </components>
   </plexus>
  
  
  
  1.4       +1 -1      maven-components/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
  
  
  
  
  1.6       +1 -1      maven-components/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/BeanGeneratorMojo.java
  
  
  
  
  1.15      +1 -1      maven-components/maven-mboot2/pom.xml
  
  Index: pom.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-mboot2/pom.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- pom.xml	13 Apr 2005 00:28:30 -0000	1.14
  +++ pom.xml	20 Apr 2005 04:16:11 -0000	1.15
  @@ -12,7 +12,7 @@
       <dependency>
         <groupId>org.codehaus.modello</groupId>
         <artifactId>modello-plugin-xpp3</artifactId>
  -      <version>1.0-alpha-1</version>
  +      <version>1.0-alpha-2-SNAPSHOT</version>
         <scope>runtime</scope>
       </dependency>
   
  
  
  

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