Jetty Plugin

  • Tags: server
  • Latest: 3.0.0
  • Last Updated: 19 May 2014
  • Grails version: 2.3.7 > *
3 votes
Dependency:
compile ":jetty:3.0.0"

 Documentation  Source  Issues

Summary

Makes Jetty the development time container for Grails

Installation

Remove the dependency in BuildConfig.groovy for the Tomcat plugin and add this in its place:

build ':jetty:2.0.3'

Description

Makes Jetty 7.6.0 the development time container for Grails

Add

info 'org.eclipse.jetty'

to your application's Config.groovy log4j section to see the Jetty information and errors.

Multiple applications

You can run additional applications in WAR format by adding this code to your application's scripts/_Events.groovy:

import org.eclipse.jetty.server.Server
import org.eclipse.jetty.server.handler.ContextHandlerCollection
import org.eclipse.jetty.webapp.WebAppContext
import org.eclipse.jetty.server.Handler

eventConfigureJetty = { Server server -> try { // add as many wars to this map as you want def wars = [other: "/path/to/otherapplication.war"]

def handlers = [server.handler] wars.each { context, filePath -> handlers << new WebAppContext(filePath, "/$context") }

server.handler = new ContextHandlerCollection(handlers: handlers as Handler[]) } catch (e) { e.printStackTrace() } }