org.apache.tomcat.maven.plugin.tomcat7.run
Class AbstractExecWarMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.tomcat.maven.plugin.tomcat7.AbstractTomcat7Mojo
          extended by org.apache.tomcat.maven.plugin.tomcat7.run.AbstractExecWarMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
AbstractStandaloneWarMojo, ExecWarMojo, ExecWarOnlyMojo

public abstract class AbstractExecWarMojo
extends AbstractTomcat7Mojo

Since:
2.0
Author:
Olivier Lamy

Field Summary
protected  String accessLogValveFormat
          see http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html
protected  org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
          Maven Artifact Factory component.
protected  org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
           
protected  boolean attachArtifact
          Attach or not the generated artifact to the build (use true if you want to install or deploy it)
protected  String attachArtifactClassifier
          the classifier to use for the attached/generated artifact
protected  String attachArtifactClassifierType
          the type to use for the attached/generated artifact
protected  File buildDirectory
           
protected  String connectorHttpProtocol
          which connector protocol to use HTTP/1.1 or org.apache.coyote.http11.Http11NioProtocol
protected  boolean enableNaming
          to enable naming when starting tomcat
protected  String[] excludes
          File patterns to exclude from extraDependencies
protected  List<ExtraDependency> extraDependencies
          list of extra dependencies to add in the standalone tomcat jar: your jdbc driver, mail.jar etc..
protected  List<ExtraResource> extraResources
          list of extra resources to add in the standalone tomcat jar: your logger configuration etc
protected  String finalName
          Name of the generated exec JAR.
protected  String httpPort
          configure a default http port for the standalone jar
protected  org.apache.maven.artifact.repository.ArtifactRepository local
          Location of the local repository.
protected  String mainClass
          Main class to use for starting the standalone jar.
protected  String path
          The webapp context path to use for the web application being run.
protected  List<org.apache.maven.artifact.Artifact> pluginArtifacts
           
protected  org.apache.maven.project.MavenProject project
          The maven project.
protected  org.apache.maven.artifact.Artifact projectArtifact
           
protected  org.apache.maven.project.MavenProjectHelper projectHelper
           
protected  List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepos
          List of Remote Repositories used by the resolver
protected  File serverXml
           
protected  File tomcatConfigurationFilesDirectory
           
protected  List<WarRunDependency> warRunDependencies
           
 
Fields inherited from class org.apache.tomcat.maven.plugin.tomcat7.AbstractTomcat7Mojo
messagesProvider, settings
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractExecWarMojo()
           
 
Method Summary
protected  File addContextXmlToWar(File contextXmlFile, File warFile)
          return file can be deleted
protected  void copyDirectoryContentIntoArchive(File sourceFolder, String destinationPath, org.apache.commons.compress.archivers.ArchiveOutputStream archiveOutputStream)
           
 void execute()
           
protected  void extractJarToArchive(JarFile file, org.apache.commons.compress.archivers.ArchiveOutputStream os, String[] excludes)
          Copy the contents of a jar file to another archive
protected  String findArtifactVersion(org.apache.maven.model.Dependency dependency)
           
protected  File resolvePluginWorkDir()
          Resolves the plugin work dir as a sub directory of buildDirectory, creating it if it does not exist.
protected  boolean sameDependencyWithoutVersion(org.apache.maven.model.Dependency that, org.apache.maven.model.Dependency dependency)
           
protected  String[] toStringArray(List list)
           
 
Methods inherited from class org.apache.tomcat.maven.plugin.tomcat7.AbstractTomcat7Mojo
checkTomcatResponse, getPath
 
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

projectArtifact

@Parameter(defaultValue="${project.artifact}",
           required=true,
           readonly=true)
protected org.apache.maven.artifact.Artifact projectArtifact

project

@Parameter(defaultValue="${project}",
           required=true,
           readonly=true)
protected org.apache.maven.project.MavenProject project
The maven project.


pluginArtifacts

@Parameter(defaultValue="${plugin.artifacts}",
           required=true)
protected List<org.apache.maven.artifact.Artifact> pluginArtifacts

buildDirectory

@Parameter(defaultValue="${project.build.directory}")
protected File buildDirectory

tomcatConfigurationFilesDirectory

@Parameter(property="maven.tomcat.exec.war.tomcatConf",
           defaultValue="src/main/tomcatconf")
protected File tomcatConfigurationFilesDirectory

serverXml

@Parameter(defaultValue="src/main/tomcatconf/server.xml",
           property="maven.tomcat.exec.war.serverXml")
protected File serverXml

finalName

@Parameter(property="tomcat.jar.finalName",
           defaultValue="${project.artifactId}-${project.version}-war-exec.jar",
           required=true)
protected String finalName
Name of the generated exec JAR.


path

@Parameter(property="maven.tomcat.path",
           defaultValue="${project.artifactId}",
           required=true)
protected String path
The webapp context path to use for the web application being run. The name to store webapp in exec jar. Do not use /


warRunDependencies

@Parameter
protected List<WarRunDependency> warRunDependencies

artifactResolver

@Component
protected org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver

artifactFactory

@Component
protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
Maven Artifact Factory component.


local

@Parameter(defaultValue="${localRepository}",
           required=true,
           readonly=true)
protected org.apache.maven.artifact.repository.ArtifactRepository local
Location of the local repository.


remoteRepos

@Parameter(defaultValue="${project.remoteArtifactRepositories}",
           required=true,
           readonly=true)
protected List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepos
List of Remote Repositories used by the resolver


projectHelper

@Component
protected org.apache.maven.project.MavenProjectHelper projectHelper

attachArtifact

@Parameter(property="maven.tomcat.exec.war.attachArtifact",
           defaultValue="true",
           required=true)
protected boolean attachArtifact
Attach or not the generated artifact to the build (use true if you want to install or deploy it)


attachArtifactClassifier

@Parameter(property="maven.tomcat.exec.war.attachArtifactClassifier",
           defaultValue="exec-war",
           required=true)
protected String attachArtifactClassifier
the classifier to use for the attached/generated artifact


attachArtifactClassifierType

@Parameter(property="maven.tomcat.exec.war.attachArtifactType",
           defaultValue="jar",
           required=true)
protected String attachArtifactClassifierType
the type to use for the attached/generated artifact


enableNaming

@Parameter(property="maven.tomcat.exec.war.enableNaming",
           defaultValue="false",
           required=true)
protected boolean enableNaming
to enable naming when starting tomcat


accessLogValveFormat

@Parameter(property="maven.tomcat.exec.war.accessLogValveFormat",
           defaultValue="%h %l %u %t %r %s %b %I %D",
           required=true)
protected String accessLogValveFormat
see http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html


extraDependencies

@Parameter
protected List<ExtraDependency> extraDependencies
list of extra dependencies to add in the standalone tomcat jar: your jdbc driver, mail.jar etc.. Those dependencies will be in root classloader.


extraResources

@Parameter
protected List<ExtraResource> extraResources
list of extra resources to add in the standalone tomcat jar: your logger configuration etc


mainClass

@Parameter(property="maven.tomcat.exec.war.mainClass",
           defaultValue="org.apache.tomcat.maven.runner.Tomcat7RunnerCli",
           required=true)
protected String mainClass
Main class to use for starting the standalone jar.


connectorHttpProtocol

@Parameter(property="maven.tomcat.exec.war.connectorHttpProtocol",
           defaultValue="HTTP/1.1",
           required=true)
protected String connectorHttpProtocol
which connector protocol to use HTTP/1.1 or org.apache.coyote.http11.Http11NioProtocol


httpPort

@Parameter(property="maven.tomcat.exec.war.httpPort")
protected String httpPort
configure a default http port for the standalone jar

Since:
2.2

excludes

@Parameter
protected String[] excludes
File patterns to exclude from extraDependencies

Since:
2.2
Constructor Detail

AbstractExecWarMojo

public AbstractExecWarMojo()
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

findArtifactVersion

protected String findArtifactVersion(org.apache.maven.model.Dependency dependency)

sameDependencyWithoutVersion

protected boolean sameDependencyWithoutVersion(org.apache.maven.model.Dependency that,
                                               org.apache.maven.model.Dependency dependency)

copyDirectoryContentIntoArchive

protected void copyDirectoryContentIntoArchive(File sourceFolder,
                                               String destinationPath,
                                               org.apache.commons.compress.archivers.ArchiveOutputStream archiveOutputStream)
                                        throws IOException
Throws:
IOException

resolvePluginWorkDir

protected File resolvePluginWorkDir()
                             throws org.apache.maven.plugin.MojoExecutionException
Resolves the plugin work dir as a sub directory of buildDirectory, creating it if it does not exist.

Returns:
File representing the resolved plugin work dir
Throws:
org.apache.maven.plugin.MojoExecutionException - if the plugin work dir cannot be created

toStringArray

protected String[] toStringArray(List list)

addContextXmlToWar

protected File addContextXmlToWar(File contextXmlFile,
                                  File warFile)
                           throws IOException,
                                  org.apache.commons.compress.archivers.ArchiveException
return file can be deleted

Throws:
IOException
org.apache.commons.compress.archivers.ArchiveException

extractJarToArchive

protected void extractJarToArchive(JarFile file,
                                   org.apache.commons.compress.archivers.ArchiveOutputStream os,
                                   String[] excludes)
                            throws IOException
Copy the contents of a jar file to another archive

Parameters:
file - The input jar file
os - The output archive
Throws:
IOException


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