org.apache.maven.listeners
Class BuildExtensionListener

java.lang.Object
  extended by org.apache.maven.listeners.BuildExtensionListener
All Implemented Interfaces:
MavenModelEventListener, org.apache.maven.shared.model.ModelEventListener

@Component(role=MavenModelEventListener.class,
           hint="extensions",
           instantiationStrategy="per-lookup")
public class BuildExtensionListener
extends java.lang.Object
implements MavenModelEventListener

This listener has two parts: the collection of the extension elements which happens during POM construction, and the processing of the build extensions once the construction is finished and the build plan is being created. The extensions that are found can be contributed to a Mercury session where a set of artifacts are retrieved and any number of extensions may be required. We don't want to load them as they are discovered because that prevents any sort of analysis so we collect, analyze and process.

Author:
Jason van Zyl

Constructor Summary
BuildExtensionListener()
           
 
Method Summary
 void fire(java.util.List<? extends org.apache.maven.shared.model.ModelContainer> modelContainers)
           
 java.util.Collection<org.apache.maven.shared.model.ModelContainerFactory> getModelContainerFactories()
           
 java.util.List<java.lang.String> getUris()
           
 void processModelContainers(MavenSession session)
          Take the extension elements that were found during the POM construction process and now retrieve all the artifacts necessary, load them in a realm, and discovery the components that are in the realm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuildExtensionListener

public BuildExtensionListener()
Method Detail

fire

public void fire(java.util.List<? extends org.apache.maven.shared.model.ModelContainer> modelContainers)
          throws org.apache.maven.shared.model.DataSourceException
Specified by:
fire in interface org.apache.maven.shared.model.ModelEventListener
Throws:
org.apache.maven.shared.model.DataSourceException

getUris

public java.util.List<java.lang.String> getUris()
Specified by:
getUris in interface org.apache.maven.shared.model.ModelEventListener

getModelContainerFactories

public java.util.Collection<org.apache.maven.shared.model.ModelContainerFactory> getModelContainerFactories()
Specified by:
getModelContainerFactories in interface org.apache.maven.shared.model.ModelEventListener

processModelContainers

public void processModelContainers(MavenSession session)
Take the extension elements that were found during the POM construction process and now retrieve all the artifacts necessary, load them in a realm, and discovery the components that are in the realm. Any components that are discovered will be available to lookups in the container from any location and the right classloader will be used to execute any components discovered in the extension realm.

Specified by:
processModelContainers in interface MavenModelEventListener
Parameters:
session - Maven session used as the execution context for the current Maven project.


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