gradle-jetty-eclipse-plugin icon indicating copy to clipboard operation
gradle-jetty-eclipse-plugin copied to clipboard

Fails if application uses spring-websocket

Open mattj65817 opened this issue 11 years ago • 0 comments

The plugin does not include Jetty Websocket support, so an attempt to run an application which uses websockets will fail. When I start an application which uses spring-websocket, for example, the exact error produced is:

IllegalStateException: No suitable default RequestUpgradeStrategy found (DefaultHandshakeHandler.java:127.)

The problem here is simply that the org.eclipse.jetty.websocket:websocket-server JAR is not included on the classpath. I can make it work by modifying the build.gradle file as follows (note the added websocket-server dependency):

buildscript { repositories { jcenter() } dependencies { classpath( [group: "com.sahlbach.gradle", name: "gradle-jetty-eclipse-plugin", version: "1.9.+"], [group: "org.eclipse.jetty.websocket", name: "websocket-server", version: "9.2.2.v20140723"] ) } }

The problem with this approach, obviously, is that it hard codes a Jetty version, and there's nothing to keep it in sync with the version which is declared within the plugin. Therefore, any time the plugin dependencies change, the build script will have to change. I am no Gradle expert--is there a better way of handling this?

It would be nice if the plugin offered built-in, possibly optional, websocket support. It's just a couple additional dependencies to make it work.

mattj65817 avatar Jan 05 '15 15:01 mattj65817