Is there any easy way to run jetty 8 from gradle (like with jettyRun)?

Unlucky I need jetty 8 to work properly with spray/akka (it's scala project). With older version used by jettyRun I'm getting error like: java.lang.NoClassDefFoundError: org/eclipse/jetty/continuation/ContinuationListener Is it possible to create some simple task to do the job which jettyRun is doing but with jetty 8?

In worst case I can use embedded version of jetty with war which I'm building, but I would be happy to see some simpler solution if there is any...


Pitor, why didn't you end up adding your excellent answer from here?

I've adapted it below, to use Jetty version 9, to depend on the war task, and to use the same task name as the jetty plugin (i.e. jettyRun).

configurations { jetty } dependencies { jetty "org.eclipse.jetty:jetty-runner:9.2.11.v20150529" } task jettyRun(type: JavaExec, dependsOn: war) { main = "org.eclipse.jetty.runner.Runner" args = [war.archivePath] classpath configurations.jetty }


gradle jettyRun


Since I wasn't able to find good solution at the gradle build level I decided to use embedded jetty. Here is scala class:

import org.eclipse.jetty.server.Server import org.eclipse.jetty.webapp.WebAppContext import org.eclipse.jetty.server.bio.SocketConnector object JettyServer { def main(args: Array[String]) { val server = new Server val context = new WebAppContext val connector = new SocketConnector connector.setMaxIdleTime(1000 * 60 * 60) connector.setPort(8080) context.setServer(server) context.setWar(args(0)) server.setConnectors(Array(connector)) server.setHandler(context) try { server.start(); server.join(); } catch { case e: Exception => e.printStackTrace(); } } }

And then in build.gradle:

apply plugin: "application" mainClassName = "com.mycompany.myproject" run.args = [war.archivePath] task jettyRun(dependsOn: run)

And everything works :)


I think it's a little late for an answer :) But I'll post it for others who would google around for the same thing.

I stumbled upon the same issue while trying to run a scalatra app with gradle. I found this plugin and it just works - https://github.com/martins1930/jettyMulti


  • How to build artifacts from IntelliJ via command line
  • opencv fitLine always crashes
  • Pandas ordered categorical data on exam grades 'D',…,'A+'
  • disadvantages of marquee tag [closed]
  • How to delete all directories (and contents) older than N days without usage of forfiles?
  • Mingw FFTW3 cannot find a library/header file
  • What are the best practices for migrating an Oracle 10g database to Microsoft SQL 2008 R2? Applicati
  • Android - FM/Radio Transmitting
  • Advantages of deploying sling + jackrabbit on tomcat?
  • Sencha Cmd broken: Why does 'app build' ignore any command line parameters?
  • Running CGI on Jetty
  • Templates, Inheritance, and Virtual Methods (C++)
  • Stall when debugging with gdbserver in VSCode - “The preLaunchTask 'docker gdb' cannot be
  • How to debug problems with the javafx native bundle for Windows?
  • Your credentials did not work Azure VM
  • R Remove zeros at the start and end of a column
  • ColdFusion - DateTime Format with GMT offset
  • IIS Equivalent of “proxy_set_header X-Forwarded-Proto https;”
  • What is wrong with this emulation of CMPXCHG16B instruction?
  • Django Migrations fail during django initialization
  • Best Datagrid for Bootstrap/jQuery?
  • Why cygnus crashes when using ngsiv2 in orion?
  • Pass nested C++ vector as built-in style multi-dimensional array
  • How to upload files in php using html
  • WebApp in AppServices vs CloudService
  • python: forcing relative imports to search from script file
  • Better Indy for Dephi 2007
  • Jenkins Grails plugin does not list lastest versions of Grails
  • Iron Router: How do I send data to the layout?
  • How to return DataSet (xsd) in WCF
  • How to generate and display a QR Code in ionic 2
  • Button text different than value submitted in query string
  • How do I open a C file with a relative path?
  • D3 nodes and links from JSON with nested arrays of children
  • Knitr HTML Loop - Some HTML output, some R output
  • Jquery - Jquery Wysiwyg return html as a string
  • Arrays break string types in Julia
  • WPF Applying a trigger on binding failure
  • Java static initializers and reflection
  • MATLAB: Piecewise function in curve fitting toolbox using fittype