code: private Map findMappingsForLifecycle( MavenProject project, Lifecycle lifecycle )
          throws LifecycleExecutionException, PluginNotFoundException
      {
          String packaging = project.getPackaging();
          Map mappings = null;
  
          LifecycleMapping m =
              (LifecycleMapping) findExtension( project, LifecycleMapping.ROLE, packaging, session.getSettings(),
                                                session.getLocalRepository() );
          if ( m != null )
          {
              mappings = m.getPhases( lifecycle.getId() );
          }
  
          Map defaultMappings = lifecycle.getDefaultPhases();
  
          if ( mappings == null )
          {
              try
              {
                  m = (LifecycleMapping) session.lookup( LifecycleMapping.ROLE, packaging );
                  mappings = m.getPhases( lifecycle.getId() );
              }
              catch ( ComponentLookupException e )
              {
                  if ( defaultMappings == null )
                  {
                      throw new LifecycleExecutionException( "Cannot find lifecycle mapping for packaging: \'"
                          + packaging + "\'.", e );
                  }
              }
          }
  
          if ( mappings == null )
          {
              if ( defaultMappings == null )
              {
                  throw new LifecycleExecutionException( "Cannot find lifecycle mapping for packaging: \'" + packaging
                      + "\', and there is no default" );
              }
              else
              {
                  mappings = defaultMappings;
              }
          }
  
          return mappings;
      }
docs: Find mappings for lifecycle.
  
  @param project the project
  @param lifecycle the lifecycle
  @return the map
  @throws LifecycleExecutionException the lifecycle execution exception
  @throws PluginNotFoundException the plugin not found exception