Is there an easy way to launch berth 8 from gradle (e.g. with jettyRun)?

No luck. I need Berth 8 to work correctly with the sprayer / acka (scala project).
With the older version used by jettyRun, I get an error, for example:
java.lang.NoClassDefFoundError: org / eclipse / jetty / continued / ContinuationListener
Is it possible to create some simple task to do the job that jettyRun does, but with berth 8?

In the worst case scenario, I can use the built-in version of the pier with the war I am creating, but I would be happy to see a simpler solution, if any ...

+2
scala maven-2 jetty gradle maven-jetty-plugin
source share
3 answers

Since I could not find a good solution at the gradle build level, I decided to use the built-in pier. Here is the 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 the build.gradle file:

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

And it works :)

0
source share

Pitor, why didn't you add a great answer from here ?

I adapted it below to use the Jetty 9 version to depend on the war task, and use the same task name as the jetty plug-in (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 } 

Using:

 gradle jettyRun 
+1
source share

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

I came across the same problem while trying to run scalatra application with gradle. I found this plugin and it just works - https://github.com/martins1930/jettyMulti

0
source share

All Articles