org.apache.tomcat.maven.plugin.tomcat6
Class AbstractRunMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.tomcat.maven.plugin.tomcat6.AbstractI18NTomcat6Mojo
          extended by org.apache.tomcat.maven.plugin.tomcat6.AbstractRunMojo
All Implemented Interfaces:
ContextEnabled, Mojo
Direct Known Subclasses:
AbstractRunWarMojo, RunMojo

public abstract class AbstractRunMojo
extends AbstractI18NTomcat6Mojo

Abstract goal that provides common configuration for embedded Tomcat goals.

Version:
$Id: AbstractRunMojo.html 1305321 2012-03-26 12:01:12Z olamy $
Author:
Jurgen Lust, Mark Hobson

Field Summary
protected  File contextFile
          The path of the Tomcat context XML file.
protected  boolean contextReloadable
          Force context scanning if you don't use a context file with reloadable = "true".
protected  MavenProject project
          The maven project.
protected  boolean useSeparateTomcatClassLoader
          if true a new classLoader separated from maven core will be created to start tomcat.
 
Fields inherited from class org.apache.tomcat.maven.plugin.tomcat6.AbstractI18NTomcat6Mojo
messagesProvider, path
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractRunMojo()
           
 
Method Summary
protected  Context createContext(Embedded container)
          Gets the context to run this web application under for the specified embedded Tomcat.
protected  WebappLoader createWebappLoader()
          Gets the webapp loader to run this web application under.
 void execute()
          
protected abstract  File getContextFile()
          Gets the Tomcat context XML file to use.
protected abstract  File getDocBase()
          Gets the webapp directory to run.
protected  String getPath()
          Gets the webapp context path to use for the web application being run.
 Set<Artifact> getProjectArtifacts()
           
protected  ClassRealm getTomcatClassLoader()
           
protected  boolean isContextReloadable()
          Determine whether the passed context.xml file declares the context as reloadable or not.
protected  boolean isWar()
          Gets whether this project uses WAR packaging.
 
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
 

Field Detail

project

protected MavenProject project
The maven project.

Since:
1.0
Is defined by:
expression:
${project}
Is readonly.
Is required.

useSeparateTomcatClassLoader

protected boolean useSeparateTomcatClassLoader
if true a new classLoader separated from maven core will be created to start tomcat.

Since:
1.0
Is defined by:
expression:
${tomcat.useSeparateTomcatClassLoader}
default-value:
false

contextReloadable

protected boolean contextReloadable
Force context scanning if you don't use a context file with reloadable = "true". The other way to use contextReloadable is to add attribute reloadable = "true" in your context file.

Since:
2.0
Is defined by:
expression:
${maven.tomcat.contextReloadable}
default-value:
false

contextFile

protected File contextFile
The path of the Tomcat context XML file.

Is defined by:
expression:
src/main/webapp/META-INF/context.xml
Constructor Detail

AbstractRunMojo

public AbstractRunMojo()
Method Detail

execute

public void execute()
             throws MojoExecutionException,
                    MojoFailureException

Throws:
MojoExecutionException
MojoFailureException

getPath

protected String getPath()
Gets the webapp context path to use for the web application being run.

Overrides:
getPath in class AbstractI18NTomcat6Mojo
Returns:
the webapp context path

createContext

protected Context createContext(Embedded container)
                         throws IOException,
                                MojoExecutionException
Gets the context to run this web application under for the specified embedded Tomcat.

Parameters:
container - the embedded Tomcat container being used
Returns:
the context to run this web application under
Throws:
IOException - if the context could not be created
MojoExecutionException - in case of an error creating the context

createWebappLoader

protected WebappLoader createWebappLoader()
                                   throws IOException,
                                          MojoExecutionException
Gets the webapp loader to run this web application under.

Returns:
the webapp loader to use
Throws:
IOException - if the webapp loader could not be created
MojoExecutionException - in case of an error creating the webapp loader

isContextReloadable

protected boolean isContextReloadable()
                               throws MojoExecutionException
Determine whether the passed context.xml file declares the context as reloadable or not.

Returns:
false by default, true if reloadable="true" in context.xml.
Throws:
MojoExecutionException

getDocBase

protected abstract File getDocBase()
Gets the webapp directory to run.

Returns:
the webapp directory

getContextFile

protected abstract File getContextFile()
                                throws MojoExecutionException
Gets the Tomcat context XML file to use.

Returns:
the context XML file
Throws:
MojoExecutionException

isWar

protected boolean isWar()
Gets whether this project uses WAR packaging.

Returns:
whether this project uses WAR packaging

getTomcatClassLoader

protected ClassRealm getTomcatClassLoader()
                                   throws MojoExecutionException
Throws:
MojoExecutionException

getProjectArtifacts

public Set<Artifact> getProjectArtifacts()


Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.