org.apache.maven.lifecycle.binding
Class DefaultLifecycleBindingManager

java.lang.Object
  extended by org.apache.maven.lifecycle.binding.DefaultLifecycleBindingManager
All Implemented Interfaces:
LifecycleBindingManager, org.codehaus.plexus.logging.LogEnabled

public class DefaultLifecycleBindingManager
extends java.lang.Object
implements LifecycleBindingManager, org.codehaus.plexus.logging.LogEnabled

Responsible for the gross construction of LifecycleBindings, or mappings of MojoBinding instances to different parts of the three lifecycles: clean, build, and site. Also, handles transcribing these LifecycleBindings instances into lists of MojoBinding's, which can be consumed by the LifecycleExecutor.

Author:
jdcasey

Field Summary
 
Fields inherited from interface org.apache.maven.lifecycle.binding.LifecycleBindingManager
ROLE
 
Constructor Summary
DefaultLifecycleBindingManager()
           
 
Method Summary
 void enableLogging(org.codehaus.plexus.logging.Logger logger)
           
 LifecycleBindings getBindingsForPackaging(MavenProject project, MavenSession session)
          Retrieve the LifecycleBindings given by the lifecycle mapping component/file for the project's packaging.
 LifecycleBindings getDefaultBindings(MavenProject project)
          Construct the LifecycleBindings for the default lifecycle mappings, including injection of configuration from the project into each MojoBinding, where appropriate.
 java.util.List getLifecycles()
           
 LifecycleBindings getPluginLifecycleOverlay(PluginDescriptor pluginDescriptor, java.lang.String lifecycleId, MavenProject project)
          Construct the LifecycleBindings that constitute the mojos mapped to the lifecycles by an overlay specified in a plugin.
 LifecycleBindings getProjectCustomBindings(MavenProject project, MavenSession session, java.util.Set unbindableMojos)
          Construct the LifecycleBindings that constitute the extra mojos bound to the lifecycle within the POM itself.
 java.util.List getReportBindings(MavenProject project, MavenSession session)
          Retrieve the list of MojoBinding instances that correspond to the reports configured for the specified project.
 void resolveUnbindableMojos(java.util.Set unbindableMojos, MavenProject project, MavenSession session, LifecycleBindings lifecycleBindings)
          Go through the set of unbindable mojos provided (these are MojoBinding instancess coming from the project as custom bindings for which we failed to determine a phase to bind them during LifecycleBindingManager.getProjectCustomBindings(MavenProject, MavenSession, Set)).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLifecycleBindingManager

public DefaultLifecycleBindingManager()
Method Detail

getLifecycles

public java.util.List getLifecycles()
Specified by:
getLifecycles in interface LifecycleBindingManager

getBindingsForPackaging

public LifecycleBindings getBindingsForPackaging(MavenProject project,
                                                 MavenSession session)
                                          throws LifecycleLoaderException,
                                                 LifecycleSpecificationException
Retrieve the LifecycleBindings given by the lifecycle mapping component/file for the project's packaging. Any applicable mojo configuration will be injected into the LifecycleBindings from the POM.

Specified by:
getBindingsForPackaging in interface LifecycleBindingManager
Throws:
LifecycleLoaderException
LifecycleSpecificationException

getDefaultBindings

public LifecycleBindings getDefaultBindings(MavenProject project)
                                     throws LifecycleSpecificationException
Construct the LifecycleBindings for the default lifecycle mappings, including injection of configuration from the project into each MojoBinding, where appropriate.

Specified by:
getDefaultBindings in interface LifecycleBindingManager
Throws:
LifecycleSpecificationException

enableLogging

public void enableLogging(org.codehaus.plexus.logging.Logger logger)
Specified by:
enableLogging in interface org.codehaus.plexus.logging.LogEnabled

getProjectCustomBindings

public LifecycleBindings getProjectCustomBindings(MavenProject project,
                                                  MavenSession session,
                                                  java.util.Set unbindableMojos)
                                           throws LifecycleLoaderException,
                                                  LifecycleSpecificationException
Construct the LifecycleBindings that constitute the extra mojos bound to the lifecycle within the POM itself.

Specified by:
getProjectCustomBindings in interface LifecycleBindingManager
Throws:
LifecycleLoaderException
LifecycleSpecificationException

getPluginLifecycleOverlay

public LifecycleBindings getPluginLifecycleOverlay(PluginDescriptor pluginDescriptor,
                                                   java.lang.String lifecycleId,
                                                   MavenProject project)
                                            throws LifecycleLoaderException,
                                                   LifecycleSpecificationException
Construct the LifecycleBindings that constitute the mojos mapped to the lifecycles by an overlay specified in a plugin. Inject mojo configuration from the POM into all appropriate MojoBinding instances.

Specified by:
getPluginLifecycleOverlay in interface LifecycleBindingManager
Throws:
LifecycleLoaderException
LifecycleSpecificationException

getReportBindings

public java.util.List getReportBindings(MavenProject project,
                                        MavenSession session)
                                 throws LifecycleLoaderException,
                                        LifecycleSpecificationException
Retrieve the list of MojoBinding instances that correspond to the reports configured for the specified project. Inject all appropriate configuration from the POM for each MojoBinding, using the following precedence rules:
  1. report-set-level configuration
  2. reporting-level configuration
  3. execution-level configuration
  4. plugin-level configuration

Specified by:
getReportBindings in interface LifecycleBindingManager
Throws:
LifecycleLoaderException
LifecycleSpecificationException

resolveUnbindableMojos

public void resolveUnbindableMojos(java.util.Set unbindableMojos,
                                   MavenProject project,
                                   MavenSession session,
                                   LifecycleBindings lifecycleBindings)
                            throws LifecycleSpecificationException
Go through the set of unbindable mojos provided (these are MojoBinding instancess coming from the project as custom bindings for which we failed to determine a phase to bind them during LifecycleBindingManager.getProjectCustomBindings(MavenProject, MavenSession, Set)). For each MojoBinding, attempt to resolve it again, and if successful, extract the default phase name from the MojoDescriptor.

Specified by:
resolveUnbindableMojos in interface LifecycleBindingManager
Throws:
LifecycleSpecificationException - In case the plugin cannot be resolved, the plugin doesn't contain the specified mojo, or the mojo doesn't have a default phase.


Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.