Class AbstractWarMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.war.AbstractWarMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
WarExplodedMojo, WarInPlaceMojo, WarMojo

public abstract class AbstractWarMojo extends org.apache.maven.plugin.AbstractMojo
Contains common jobs for WAR mojos.
  • Field Details

    • failOnMissingWebXml

      @Parameter protected Boolean failOnMissingWebXml
      Whether to fail the build if the web.xml file is missing. Set to false if you want your WAR built without a web.xml file. This may be useful if you are building an overlay that has no web.xml file.

      Starting with 3.1.0, this property defaults to false if the project depends on the Servlet 3.0 API or newer.

      Since:
      2.1-alpha-2
    • propertiesEncoding

      @Parameter protected String propertiesEncoding
      The character encoding to use when reading and writing filtered properties files. If not specified, it will default to the value of the "resourceEncoding" parameter.
      Since:
      3.4.0
    • escapeString

      @Parameter protected String escapeString
      Expression preceded with this String won't be interpolated. \${foo} will be replaced with ${foo}.
      Since:
      2.1-beta-1
    • outputTimestamp

      @Parameter(defaultValue="${project.build.outputTimestamp}") protected String outputTimestamp
      Timestamp for reproducible output archive entries, either formatted as ISO 8601 yyyy-MM-dd'T'HH:mm:ssXXX or as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).
      Since:
      3.3.0
  • Constructor Details

    • AbstractWarMojo

      protected AbstractWarMojo(org.codehaus.plexus.archiver.jar.JarArchiver jarArchiver, org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, org.codehaus.plexus.archiver.manager.ArchiverManager archiverManager, org.apache.maven.shared.filtering.MavenFileFilter mavenFileFilter, org.apache.maven.shared.filtering.MavenResourcesFiltering mavenResourcesFiltering)
  • Method Details

    • getCurrentProjectOverlay

      public Overlay getCurrentProjectOverlay()
      Returns:
      The current overlay.
    • getExcludes

      protected String[] getExcludes()
      Returns a string array of the excludes to be used when copying the content of the WAR source directory.
      Returns:
      an array of tokens to exclude
    • getIncludes

      protected String[] getIncludes()
      Returns a string array of the includes to be used when assembling/copying the WAR.
      Returns:
      an array of tokens to include
    • getDependentWarExcludes

      protected String[] getDependentWarExcludes()
      Returns a string array of the excludes to be used when adding dependent WAR as an overlay onto this WAR.
      Returns:
      an array of tokens to exclude
    • getDependentWarIncludes

      protected String[] getDependentWarIncludes()
      Returns a string array of the includes to be used when adding dependent WARs as an overlay onto this WAR.
      Returns:
      an array of tokens to include
    • buildExplodedWebapp

      public void buildExplodedWebapp(File webapplicationDirectory) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Parameters:
      webapplicationDirectory - The web application directory.
      Throws:
      org.apache.maven.plugin.MojoExecutionException - In case of failure.
      org.apache.maven.plugin.MojoFailureException - In case of failure.
    • buildWebapp

      public void buildWebapp(org.apache.maven.project.MavenProject mavenProject, File webapplicationDirectory) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException, IOException
      Builds the webapp for the specified project with the new packaging task thingy. Classes, libraries and tld files are copied to the webappDirectory during this phase.
      Parameters:
      mavenProject - the maven project
      webapplicationDirectory - the target directory
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if an error occurred while packaging the webapp
      org.apache.maven.plugin.MojoFailureException - if an unexpected error occurred while packaging the webapp
      IOException - if an error occurred while copying the files
    • getProject

      public org.apache.maven.project.MavenProject getProject()
      Returns:
      The Maven Project.
    • setProject

      public void setProject(org.apache.maven.project.MavenProject project)
      Parameters:
      project - The project to be set.
    • getClassesDirectory

      public File getClassesDirectory()
      Returns:
      the classes directory.
    • setClassesDirectory

      public void setClassesDirectory(File classesDirectory)
      Parameters:
      classesDirectory - The classes directory to be set.
    • getWebappDirectory

      public File getWebappDirectory()
      Returns:
      webappDirectory
    • setWebappDirectory

      public void setWebappDirectory(File webappDirectory)
      Parameters:
      webappDirectory - The web application directory.
    • getWarSourceDirectory

      public File getWarSourceDirectory()
      Returns:
      warSourceDirectory
    • setWarSourceDirectory

      public void setWarSourceDirectory(File warSourceDirectory)
      Parameters:
      warSourceDirectory - warSourceDirectory
    • getWebXml

      public File getWebXml()
      Returns:
      The webXml
    • setWebXml

      public void setWebXml(File webXml)
      Parameters:
      webXml - The webXml
    • getContainerConfigXML

      public File getContainerConfigXML()
      Returns:
      containerConfigXML
    • setContainerConfigXML

      public void setContainerConfigXML(File containerConfigXML)
      Parameters:
      containerConfigXML - containerConfigXML
    • getOutputFileNameMapping

      public String getOutputFileNameMapping()
      Returns:
      outputFileNameMapping
    • setOutputFileNameMapping

      public void setOutputFileNameMapping(String outputFileNameMapping)
      Parameters:
      outputFileNameMapping - outputFileNameMapping
    • getOverlays

      public List<Overlay> getOverlays()
      Returns:
      overlays
    • setOverlays

      public void setOverlays(List<Overlay> overlays)
      Parameters:
      overlays - overlays
    • addOverlay

      public void addOverlay(Overlay overlay)
      Parameters:
      overlay - add overlays.
    • isArchiveClasses

      public boolean isArchiveClasses()
      Returns:
      archiveClasses
    • getJarArchiver

      public org.codehaus.plexus.archiver.jar.JarArchiver getJarArchiver()
      Returns:
      JarArchiver
    • getWebResources

      public org.apache.maven.model.Resource[] getWebResources()
      Returns:
      webResources.
    • setWebResources

      public void setWebResources(org.apache.maven.model.Resource[] webResources)
      Parameters:
      webResources - webResources.
    • getFilters

      public List<String> getFilters()
      Returns:
      filters
    • getWorkDirectory

      public File getWorkDirectory()
      Returns:
      workDirectory
    • getWarSourceIncludes

      public String getWarSourceIncludes()
      Returns:
      warSourceIncludes
    • getWarSourceExcludes

      public String getWarSourceExcludes()
      Returns:
      warSourceExcludes
    • getArchive

      public org.apache.maven.archiver.MavenArchiveConfiguration getArchive()
      Returns:
      archive
    • getNonFilteredFileExtensions

      public List<String> getNonFilteredFileExtensions()
      Returns:
      nonFilteredFileExtensions
    • getArtifactFactory

      public org.apache.maven.artifact.factory.ArtifactFactory getArtifactFactory()
      Returns:
      artifactFactory
    • getSession

      protected org.apache.maven.execution.MavenSession getSession()
      Returns:
      session
    • isRecompressZippedFiles

      protected boolean isRecompressZippedFiles()
      Returns:
      recompressZippedFiles
    • isIncludeEmptyDirectories

      protected boolean isIncludeEmptyDirectories()
      Returns:
      includeEmptyDirectories
    • getPackagingExcludes

      public String[] getPackagingExcludes()
      Returns:
      The package excludes.
    • setPackagingExcludes

      public void setPackagingExcludes(String packagingExcludes)
      Parameters:
      packagingExcludes - packagingExcludes
    • getPackagingIncludes

      public String[] getPackagingIncludes()
      Returns:
      The packaging includes.
    • setPackagingIncludes

      public void setPackagingIncludes(String packagingIncludes)
      Parameters:
      packagingIncludes - packagingIncludes