com.vecna.maven.commons
Class AbstractClassLoaderSwappingMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by com.vecna.maven.commons.AbstractClassLoaderSwappingMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
BuildClassPathMojo

public abstract class AbstractClassLoaderSwappingMojo
extends org.apache.maven.plugin.AbstractMojo

Base class for invoking Mojos with a custom classloader.

Author:
ogolberg@vecna.com

Field Summary
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractClassLoaderSwappingMojo()
           
 
Method Summary
 void execute()
          
protected abstract  void executeWithClassLoader()
          This method will be executed in the custom class loader context
protected abstract  ClassLoader getClassLoader()
          Get the custom class loader
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractClassLoaderSwappingMojo

public AbstractClassLoaderSwappingMojo()
Method Detail

getClassLoader

protected abstract ClassLoader getClassLoader()
                                       throws org.apache.maven.plugin.MojoExecutionException,
                                              org.apache.maven.plugin.MojoFailureException
Get the custom class loader

Returns:
the custom class loader to use
Throws:
org.apache.maven.plugin.MojoExecutionException - if an error occurs
org.apache.maven.plugin.MojoFailureException - if an error occurs

executeWithClassLoader

protected abstract void executeWithClassLoader()
                                        throws org.apache.maven.plugin.MojoExecutionException,
                                               org.apache.maven.plugin.MojoFailureException
This method will be executed in the custom class loader context

Throws:
org.apache.maven.plugin.MojoExecutionException - if an error occurs
org.apache.maven.plugin.MojoFailureException - if an error occurs

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException,
                    org.apache.maven.plugin.MojoFailureException

Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException


Copyright © 2009-2011 Vecna Technologies. All Rights Reserved.