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:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
AbstractRunWarMojo, RunMojo

public abstract class AbstractRunMojo
extends AbstractI18NTomcat6Mojo

Abstract goal that provides common configuration for embedded Tomcat goals.

Author:
Jurgen Lust, Mark Hobson

Field Summary
protected  String[] aliases
          configure aliases see Host Name aliases
protected  org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
          Used to look up Artifacts in the remote repository.
protected  org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
          Used to look up Artifacts in the remote repository.
protected  int backgroundProcessorDelay
          represents the delay in seconds between each classPathScanning change invocation
protected  String classLoaderClass
          Class loader class to set.
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  String hostName
          configure host name
protected  org.apache.maven.shared.filtering.MavenFileFilter mavenFileFilter
           
protected  org.apache.maven.project.MavenProject project
          The maven project.
protected  org.apache.maven.execution.MavenSession session
           
protected  boolean skip
          Skip execution
protected  boolean useBodyEncodingForURI
           
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, settings
 
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  org.apache.maven.artifact.Artifact getArtifact(AbstractWebapp additionalWebapp)
          Resolves the Artifact from the remote repository if necessary.
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<org.apache.maven.artifact.Artifact> getProjectArtifacts()
           
protected  org.codehaus.plexus.classworlds.realm.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.tomcat.maven.plugin.tomcat6.AbstractI18NTomcat6Mojo
checkTomcatResponse
 
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

artifactFactory

@Component(role=org.apache.maven.artifact.factory.ArtifactFactory.class)
protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
Used to look up Artifacts in the remote repository.


artifactResolver

@Component(role=org.apache.maven.artifact.resolver.ArtifactResolver.class)
protected org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
Used to look up Artifacts in the remote repository.


project

@Component
protected org.apache.maven.project.MavenProject project
The maven project.

Since:
1.0

useSeparateTomcatClassLoader

@Parameter(property="tomcat.useSeparateTomcatClassLoader",
           defaultValue="false")
protected boolean useSeparateTomcatClassLoader
if true a new classLoader separated from maven core will be created to start tomcat.

Since:
1.0

contextReloadable

@Parameter(property="maven.tomcat.contextReloadable",
           defaultValue="false")
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

backgroundProcessorDelay

@Parameter(property="maven.tomcat.backgroundProcessorDelay",
           defaultValue="-1")
protected int backgroundProcessorDelay
represents the delay in seconds between each classPathScanning change invocation

See Also:
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

contextFile

@Parameter(defaultValue="src/main/webapp/META-INF/context.xml")
protected File contextFile
The path of the Tomcat context XML file.


skip

@Parameter(property="maven.tomcat.skip",
           defaultValue="false")
protected boolean skip
Skip execution

Since:
2.0

hostName

@Parameter(property="maven.tomcat.hostName",
           defaultValue="localhost")
protected String hostName
configure host name

Since:
2.1

aliases

@Parameter
protected String[] aliases
configure aliases see Host Name aliases

Since:
2.1

classLoaderClass

@Parameter
protected String classLoaderClass
Class loader class to set.

Since:
2.0

useBodyEncodingForURI

@Parameter(property="maven.tomcat.useBodyEncodingForURI",
           defaultValue="false")
protected boolean useBodyEncodingForURI
Since:
2.2

session

@Parameter(defaultValue="${session}",
           readonly=true,
           required=true)
protected org.apache.maven.execution.MavenSession session

mavenFileFilter

@Component(role=org.apache.maven.shared.filtering.MavenFileFilter.class,
           hint="default")
protected org.apache.maven.shared.filtering.MavenFileFilter mavenFileFilter
Constructor Detail

AbstractRunMojo

public AbstractRunMojo()
Method Detail

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

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,
                                org.apache.maven.plugin.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
org.apache.maven.plugin.MojoExecutionException - in case of an error creating the context

createWebappLoader

protected WebappLoader createWebappLoader()
                                   throws IOException,
                                          org.apache.maven.plugin.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
org.apache.maven.plugin.MojoExecutionException - in case of an error creating the webapp loader

isContextReloadable

protected boolean isContextReloadable()
                               throws org.apache.maven.plugin.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:
org.apache.maven.plugin.MojoExecutionException

getDocBase

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

Returns:
the webapp directory

getContextFile

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

Returns:
the context XML file
Throws:
org.apache.maven.plugin.MojoExecutionException

isWar

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

Returns:
whether this project uses WAR packaging

getTomcatClassLoader

protected org.codehaus.plexus.classworlds.realm.ClassRealm getTomcatClassLoader()
                                                                         throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

getProjectArtifacts

public Set<org.apache.maven.artifact.Artifact> getProjectArtifacts()

getArtifact

protected org.apache.maven.artifact.Artifact getArtifact(AbstractWebapp additionalWebapp)
                                                  throws org.apache.maven.plugin.MojoExecutionException
Resolves the Artifact from the remote repository if necessary. If no version is specified, it will be retrieved from the dependency list or from the DependencyManagement section of the pom.

Parameters:
additionalWebapp - containing information about artifact from plugin configuration.
Returns:
Artifact object representing the specified file.
Throws:
org.apache.maven.plugin.MojoExecutionException - with a message if the version can't be found in DependencyManagement.


Copyright © 2005–2014 The Apache Software Foundation. All rights reserved.