I have a JAX-RS project which have jetty plugin in gradle. I want to replace jetty plugin with gretty as jetty is not supported in gradle 4 and other versions. I get following errors while running gretty plugin.
Execution failed for task ':appRunWar'.
java.lang.Exception: com/sun/jersey/spi/inject/InjectableProvider
build.gradle code containing jetty plugin
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'jetty'
apply plugin: 'eclipse'
jettyRun {
httpPort = 8080
reload = 'automatic'
scanIntervalSeconds = 2
daemon = false
}
//other things....
build.gradle code for replacing jetty with gretty
apply plugin: 'java'
apply plugin: 'war'
apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'
apply plugin: 'eclipse'
gretty {
httpPort = 8080
//contextPath = '/'
servletContainer = 'jetty9'
httpEnabled = true
}
//other things...
First of all, do not use Akhikhl's gretty since its not maintained anymore and shows difficulties with certain jetty versions eg. jetty94 and jetty93. Additionally there is no support for Java versions 9 and 10. Instead you should rely on the gretty-gradle-plugin which is a direct maintained fork:
The configuration you provide for gretty is the default configuration, you can drop it.
The default configuration in the
ServerConfig.groovy
looks like the following:Be aware that the gretty-gradle-plugin can be found at
'org.gretty'
where as Akhikhl's gretty is located at'org.akhikhl.gretty'
. If your error persists please provide a full stacktrace and update your answer accordingly.