Created
October 28, 2013 10:18
-
-
Save akhikhl/7194463 to your computer and use it in GitHub Desktop.
groovy script for starting jetty server against the specified folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('javax.servlet:javax.servlet-api:3.0.1') | |
@Grab(group='org.eclipse.jetty', module='jetty-webapp', version='8.1.8.v20121106') | |
@Grab(group='org.eclipse.jetty', module='jetty-server', version='8.1.8.v20121106', transitive=false) | |
@Grab(group='org.eclipse.jetty', module='jetty-servlet', version='8.1.8.v20121106', transitive=false) | |
@GrabExclude('org.eclipse.jetty.orbit:javax.servlet') | |
import org.eclipse.jetty.server.Server | |
import org.eclipse.jetty.servlet.* | |
import groovy.servlet.* | |
def publishedFolder = args ? args[0] : '.' | |
def server = new Server(8080) | |
def context = new ServletContextHandler(server, '/', ServletContextHandler.SESSIONS) | |
def webappContext = new org.eclipse.jetty.webapp.WebAppContext(publishedFolder, '/jetty') | |
context.setHandler(webappContext) | |
server.start() | |
println 'Jetty server started. Press Ctrl+C to stop.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment