Reputation: 2735
I have a Gradle project, and I'm trying to run it with it Jetty.
My build.gradle
file looks like following.
build.gradle
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'jetty'
[jettyRun, jettyRunWar]*.httpPort = 8080
[jettyRun, jettyRunWar]*.contextPath = ''
[jettyRun, jettyRunWar]*.daemon = true
[jettyRun, jettyRunWar, jettyStop]*.stopPort = 8081
[jettyRun, jettyRunWar, jettyStop]*.stopKey = 'stop'
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceSets {
test {
java {
srcDirs = ['src/test/java']
}
}
}
dependencies {
compile 'org.glassfish.jersey.containers:jersey-container-servlet:2.14'
compile 'org.glassfish.jersey.media:jersey-media-json-jackson:2.14'
compile 'com.google.guava:guava:14.0.1'
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile 'org.mockito:mockito-all:1.10.19'
testCompile 'org.eclipse.jetty:jetty-server:9.4.7.v20170914'
testCompile 'org.eclipse.jetty:jetty-webapp:9.4.7.v20170914'
}
I'm trying to run this project from the command line, and the commands I'm using are:
./gradlew
which should build the project, and outputs the following:
The Jetty plugin has been deprecated and is scheduled to be removed in Gradle 4.0. Consider using the Gretty (https://github.com/akhikhl/gretty) plugin instead. at build_6xw4u3prr68h02k136x2vqowd.run(/myproject/build.gradle:3) :help
Welcome to Gradle 3.2.1.
gradle jettyRun
which failed with the statement Plugin with id 'jetty' not found.
So the question is, how do I run such a project? Note that I didn't write this project, I just need to run it on my local machine.
Upvotes: 5
Views: 16103
Reputation: 1752
I am no expert in Gradle, just a beginner, but i think I found something that can help you. I was also reading about using jetty with gradle, since I used it frequently with Maven.
Turns out, Jetty as a plugin is no longer supported as you can find here: https://docs.gradle.org/current/userguide/jetty_plugin.html
Instead, you are supposed to use gretty for the same end: https://plugins.gradle.org/plugin/org.gretty
Hope this was helpful.
Upvotes: 3