Class JettyStartWarMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.eclipse.jetty.maven.plugin.AbstractWebAppMojo
org.eclipse.jetty.maven.plugin.JettyStartWarMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="start-war", requiresDependencyResolution=RUNTIME) public class JettyStartWarMojo extends AbstractWebAppMojo

This goal is used to run Jetty with any pre-assembled war. This goal does not have to be used with a project of packaging type "war".

You can configure the "webApp" element with the location of either a war file or an unpacked war that you wish to deploy - in either case, the webapp must be fully compiled and assembled as this goal does not do anything other than start jetty with the given webapp. If you do not configure the "webApp" element, then the goal will default to using the war of the webapp project.

This goal is designed to be bound to a build phase, and NOT to be run at the command line. It will not block waiting for jetty to execute, but rather continue execution.

This goal is useful e.g. for launching a web app in Jetty as a target for unit-tested HTTP client components via binding to the test-integration build phase.

You can configure this goal to run the webapp either in-process with maven, or forked into a new process, or deployed into a ${jetty.base} directory.

  • Field Details

    • webAppSourceDirectory

      @Parameter(defaultValue="${project.baseDir}/src/main/webapp") protected File webAppSourceDirectory
    • embedder

      protected JettyEmbedder embedder
    • forker

      protected JettyForker forker
    • homeForker

      protected JettyHomeForker homeForker
  • Constructor Details

    • JettyStartWarMojo

      public JettyStartWarMojo()
  • Method Details

    • configureWebApp

      public void configureWebApp() throws Exception
      Description copied from class: AbstractWebAppMojo
      Ensure there is a webapp, and that some basic defaults are applied if the user has not supplied them.
      Overrides:
      configureWebApp in class AbstractWebAppMojo
      Throws:
      Exception
    • startJettyEmbedded

      public void startJettyEmbedded() throws org.apache.maven.plugin.MojoExecutionException
      Start a jetty instance in process to run given war.
      Specified by:
      startJettyEmbedded in class AbstractWebAppMojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • startJettyForked

      public void startJettyForked() throws org.apache.maven.plugin.MojoExecutionException
      Fork a jetty instance to run the given war.
      Specified by:
      startJettyForked in class AbstractWebAppMojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • startJettyHome

      public void startJettyHome() throws org.apache.maven.plugin.MojoExecutionException
      Fork a jetty distro to run the given war.
      Specified by:
      startJettyHome in class AbstractWebAppMojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException
    • verifyPomConfiguration

      protected void verifyPomConfiguration() throws org.apache.maven.plugin.MojoExecutionException
      Description copied from class: AbstractWebAppMojo
      Used by subclasses.
      Overrides:
      verifyPomConfiguration in class AbstractWebAppMojo
      Throws:
      org.apache.maven.plugin.MojoExecutionException