Home‎ > ‎Maven‎ > ‎Plugins‎ > ‎

Jetty

Running a local Jetty server to run the GWT application for testing. 

Reference

Jetty Maven Plugin Configuration

1. First add the properties for the plugin.
<properties>
   
<jetty-plugin.version>8.1.0.v20120127</jetty-plugin.version>
   
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
</properties>
2. Next add the Jetty server configuration by adding the plugin to the plugins. With GWT the port is set by default to 8888. 
<plugins>
   
<!-- Server for running Cucumber tests *TestInt.java -->
   
<!-- 'mvn jetty:run' deploys and starts -->
   
<!-- mvn jetty:start -->
   
<!-- mvn jetty:stop -->
   
<!-- mvn jetty:run -->
   
<!-- mvn integration-test -Pintegration-test -->
   
<plugin>
       
<groupId>org.mortbay.jetty</groupId>
       
<artifactId>jetty-maven-plugin</artifactId>
       
<version>${jetty-plugin.version}</version>
       
<configuration>
           
<scanIntervalSeconds>10</scanIntervalSeconds>
           
<stopPort>9966</stopPort>
           
<stopKey>stop-jetty</stopKey>
           
<webAppSourceDirectory>${webappDirectory}</webAppSourceDirectory>
           
<webApp>
               
<descriptor>${webappDirectory}/WEB-INF</descriptor>
           
</webApp>
           
<systemProperties>
               
<systemProperty>
                   
<name>jetty.port</name>
                   
<value>8888</value>
               
</systemProperty>
           
</systemProperties>
       
</configuration>
       
<executions>
           
<execution>
               
<id>start-jetty</id>
               
<phase>pre-integration-test</phase>
               
<goals>
                   
<goal>run</goal>
               
</goals>
               
<configuration>
                   
<daemon>true</daemon>
                   
<scanIntervalSeconds>0</scanIntervalSeconds>
               
</configuration>
           
</execution>
           
<execution>
               
<id>stop-jetty</id>
               
<phase>post-integration-test</phase>
               
<goals>
                   
<goal>stop</goal>
               
</goals>
           
</execution>
       
</executions>
   
</plugin>
</plugins>
3. Start the server with 'mvn jetty:start'.








Comments