This artifact has been retired! New location is: org.eclipse.jetty:jetty-maven-plugin

logo Jetty :: Jetty Maven Plugin

homepage: www.eclipse.org/jetty
fresh index:
last release: 7 years ago, first release: 1 decade ago
packaging: maven-plugin
get this artifact from: central
see this artifact on: search.maven.org


Display vulnerabilities (snyk): Vulnerability check

This chart shows how much is this artifact used as a dependency in other Maven artifacts in Central repository and GitHub:


select version:

Add this snippet into pom.xml inside tag <project><build><plugins>:




Switch to artifact.
goals:
jetty:stop

JettyStopMojo - stops a running instance of jetty. The ff are required: -DstopKey=someKey -DstopPort=somePort

jetty:run

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 explicity 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, and more detailed information with examples in the Configuration Guide.

jetty:run-forked

This goal is used to assemble your webapp into a war and automatically deploy it to Jetty in a forked JVM. You need to define a jetty.xml file to configure connectors etc and a context xml file that sets up anything special about your webapp. This plugin will fill in the: context path classes web.xml root of the webapp Based on a combination of information that you supply and the location of files in your unassembled webapp. There is a reference guide to the configuration parameters for this plugin, and more detailed information with examples in the Configuration Guide.

jetty:run-war

This goal is used to assemble your webapp into a war and automatically deploy it to Jetty. Once invoked, the plugin can be configured to run continuously, scanning for changes in the project and to the war file and automatically performing 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. 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, and more detailed information with examples in the Configuration Guide.

jetty:run-exploded

This goal is used to assemble your webapp into an exploded war and automatically deploy it to Jetty. Once invoked, the plugin can be configured to run continuously, scanning for changes in the pom.xml and to WEB-INF/web.xml, WEB-INF/classes or WEB-INF/lib and hot redeploy when a change is detected. 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, and more detailed information with examples in the Configuration Guide.

jetty:deploy-war

This goal is used to run Jetty with a pre-assembled war. It accepts exactly the same options as the run-war goal. However, it doesn't assume that the current artifact is a webapp and doesn't try to assemble it into a war before its execution. So using it makes sense only when used in conjunction with the webApp configuration parameter pointing to a pre-built WAR. This goal is useful e.g. for launching a web app in Jetty as a target for unit-tested HTTP client components.

jetty:help

Display help information on jetty-maven-plugin. Call mvn jetty:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.

jetty:start

This goal is similar to the jetty:run goal, EXCEPT that it is designed to be bound to an execution inside your pom, rather than being run from the command line. When using it, be careful to ensure that you bind it to a phase in which all necessary generated files and classes for the webapp will have been created. If you run it from the command line, then also ensure that all necessary generated files and classes for the webapp already exist.

Often used code snippets:

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>8.1.4.v20120524</version>
  <configuration>
    <webAppConfig>
      <contextPath>/${project.name}</contextPath>
    </webAppConfig>
  </configuration>
</plugin>
<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>8.1.5.v20120716</version>
  <configuration>
    <scanIntervalSeconds>0</scanIntervalSeconds>
  </configuration>
</plugin>
<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>${jetty.version}</version>
  <configuration>
    <connectors>
      <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
        <port>8080</port>
        <maxIdleTime>3600000</maxIdleTime>
      </connector>
      <connector implementation="org.eclipse.jetty.server.ssl.SslSocketConnector">
        <port>8443</port>
        <maxIdleTime>3600000</maxIdleTime>
        <keystore>${project.build.directory}/test-classes/keystore</keystore>
        <password>wicket</password>
        <keyPassword>wicket</keyPassword>
      </connector>
    </connectors>
  </configuration>
</plugin>
<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>${jettyVersion}</version>
  <configuration>
    <webApp>
      <defaultsDescriptor>gitiles-war/webdefault.xml</defaultsDescriptor>
    </webApp>
    <war>gitiles-war/target/gitiles-war-${project.version}.war</war>
  </configuration>
</plugin>
<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>8.0.3.v20111011</version>
  <configuration>
    <scanIntervalSeconds>3</scanIntervalSeconds>
    <webAppConfig>
      <contextPath>/${project.build.finalName}</contextPath>
    </webAppConfig>
  </configuration>
</plugin>

© Jiri Pinkas 2015 - 2022. All rights reserved! Admin login To submit bugs / feature requests please use this github page
related: JavaVids | Top Java Blogs | Java školení
Apache and Apache Maven are trademarks of the Apache Software Foundation. The Central Repository is a service mark of Sonatype, Inc.