Class JettyRunWarMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

    @Mojo(name="run-war",
          requiresDependencyResolution=COMPILE_PLUS_RUNTIME)
    @Execute(phase=PACKAGE)
    public class JettyRunWarMojo
    extends AbstractWebAppMojo

    This goal is used to assemble your webapp into a war and automatically deploy it to Jetty.

    Once invoked, the plugin runs continuously and can be configured to scan for changes in the project and to the war file and automatically perform a hot redeploy when necessary.

    You may also specify the location of a jetty.xml file whose contents will be applied before any plugin configuration.

    You can configure this goal to run your webapp either in-process with maven, or forked into a new process, or deployed into a jetty distribution.

    • Field Detail

      • scan

        @Parameter(defaultValue="0",
                   property="jetty.scan",
                   required=true)
        protected int scan
        The interval in seconds to pause before checking if changes have occurred and re-deploying as necessary. A value of 0 indicates no re-deployment will be done. In that case, you can force redeployment by typing a linefeed character at the command line.
      • scanner

        protected Scanner scanner
        Scanner to check for files changes to cause redeploy
      • war

        protected java.nio.file.Path war
    • Constructor Detail

      • JettyRunWarMojo

        public JettyRunWarMojo()
    • Method Detail

      • configureWebApp

        public void configureWebApp()
                             throws java.lang.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:
        java.lang.Exception
      • startJettyEmbedded

        public void startJettyEmbedded()
                                throws org.apache.maven.plugin.MojoExecutionException
        Start a jetty instance in process to run the built 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 built war.
        Specified by:
        startJettyForked in class AbstractWebAppMojo
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • startJettyHome

        public void startJettyHome()
                            throws org.apache.maven.plugin.MojoExecutionException
        Deploy the built war to a jetty distro.
        Specified by:
        startJettyHome in class AbstractWebAppMojo
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • startScanner

        public void startScanner()
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • configureScanner

        public void configureScanner()
                              throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • restartWebApp

        public void restartWebApp​(boolean reconfigure)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception