Class JettyRunMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
    Direct Known Subclasses:
    JettyEffectiveWebXml, JettyRunDistro, JettyRunForkedMojo, JettyStartMojo

    public class JettyRunMojo
    extends AbstractJettyMojo
    This goal is used in-situ on a Maven project without first requiring that the project is assembled into a war, saving time during the development cycle.

    The plugin forks a parallel lifecycle to ensure that the "compile" phase has been completed before invoking Jetty. This means that you do not need to explicitly execute a "mvn compile" first. It also means that a "mvn clean jetty:run" will ensure that a full fresh compile is done before invoking Jetty.

    Once invoked, the plugin can be configured to run continuously, scanning for changes in the project and automatically performing a hot redeploy when necessary. This allows the developer to concentrate on coding changes to the project using their IDE of choice and have those changes immediately and transparently reflected in the running web container, eliminating development time that is wasted on rebuilding, reassembling and redeploying.

    You may also specify the location of a jetty.xml file whose contents will be applied before any plugin configuration. This can be used, for example, to deploy a static webapp that is not part of your maven build.

    There is a reference guide to the configuration parameters for this plugin. Runs jetty directly from a maven project

    • Field Detail


        public static final java.lang.String DEFAULT_WEBAPP_SRC
      • useTestScope

        protected boolean useTestScope
        If true, the <testOutputDirectory> and the dependencies of <scope>test<scope> will be put first on the runtime classpath.
      • webXml

        protected java.lang.String webXml
        The default location of the web.xml file. Will be used if <webApp><descriptor> is not set.
      • classesDirectory

        protected classesDirectory
        The directory containing generated classes.
      • scanClassesPattern

        protected ScanPattern scanClassesPattern
        An optional pattern for includes/excludes of classes in the classesDirectory
      • testClassesDirectory

        protected testClassesDirectory
        The directory containing generated test classes.
      • scanTestClassesPattern

        protected ScanPattern scanTestClassesPattern
        An optional pattern for includes/excludes of classes in the testClassesDirectory
      • webAppSourceDirectory

        protected webAppSourceDirectory
        Root directory for all html/jsp etc files
      • scanTargets

        protected[] scanTargets
        List of files or directories to additionally periodically scan for changes. Optional.
      • scanTargetPatterns

        protected ScanTargetPattern[] scanTargetPatterns
        List of directories with ant-style <include> and <exclude> patterns for extra targets to periodically scan for changes. Can be used instead of, or in conjunction with <scanTargets>.Optional.
      • warPluginInfo

        protected WarPluginInfo warPluginInfo
        maven-war-plugin reference
      • warArtifacts

        protected java.util.List<org.apache.maven.artifact.Artifact> warArtifacts
        List of deps that are wars
      • originalBaseResource

        protected Resource originalBaseResource
    • Constructor Detail

      • JettyRunMojo

        public JettyRunMojo()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException,
        Specified by:
        execute in interface org.apache.maven.plugin.Mojo
        execute in class AbstractJettyMojo
        See Also:
      • gatherScannables

        public void gatherScannables()
                              throws java.lang.Exception
      • unpackOverlays

        public void unpackOverlays​(java.util.List<Overlay> overlays)
                            throws java.lang.Exception
      • unpackOverlay

        public Resource unpackOverlay​(Overlay overlay)
      • getArtifactForOverlay

        protected org.apache.maven.artifact.Artifact getArtifactForOverlay​(OverlayConfig o,
                                                                           java.util.List<org.apache.maven.artifact.Artifact> warArtifacts)
      • getJavaBin

        protected java.lang.String getJavaBin()
      • fileSeparators

        public static java.lang.String fileSeparators​(java.lang.String path)