How to Solve Gradle Error: Plugin with id ‘jetty’ not found.

In a web project, jetty is used. When building the project with gradle, I found the prompt Plugin with id’jetty’ not found. That is, the plug-in could not be found.

The Groovy code is as follows:

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'jetty'
 
repositories {
	mavenCentral()
}
 
dependencies {
	providedCompile 'javax.servlet:servlet-api:2.5',
					'javax.servlet.jsp:jsp-api:2.1'
	runtime 'javax.servlet:jstl:1.1.2',
			'taglibs:standard:1.1.2'
}

The prompt is as follows

FAILURE: Build failed with an exception.

* Where:
Build file ‘H:\gradleCode\test\build.gradle’ line: 3

* What went wrong:
A problem occurred evaluating root project ‘test’.
> Plugin with id ‘jetty’ not found.

* Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option
to get more log output. Run with –scan to get full insights.

* Get more help at https://help.gradle.org

I went to the official website and found a post https://discuss.gradle.org/t/gradle2-still-cant-specify-jetty-version/5069

It is said that jetty cannot specify a specific version in Gradle 1.x, but my hint is that this plug-in is not found at all, I am very confused. . . .

Someone in the post said that I recommend a third-party library gretty. I tried it and it succeeded.

If you are using Gradle version 2.1 or higher, just these few lines of code will do.

plugins {
  id "org.akhikhl.gretty" version "2.0.0"
}

Otherwise, write a few more lines:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.org.akhikhl.gretty:gretty:2.0.0"
  }
}
 
apply plugin: "org.akhikhl.gretty"

This is my build.gradle:

apply plugin: 'java'
apply plugin: 'war'
buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.org.akhikhl.gretty:gretty:2.0.0"
  }
}
 
apply plugin: "org.akhikhl.gretty"
repositories {
	jcenter()
}
 
dependencies {
	providedCompile 'javax.servlet:servlet-api:2.5',
					'javax.servlet.jsp:jsp-api:2.1'
	runtime 'javax.servlet:jstl:1.1.2',
			'taglibs:standard:1.1.2'
}

The results of the operation are as follows:

gradle build

 

Download https://plugins.gradle.org/m2/gradle/plugin/org/akhikhl/gretty/gretty/2.0.0/gr
etty-2.0.0.pom
Download https://plugins.gradle.org/m2/org/akhikhl/gretty/gretty-core/2.0.0/gretty-core
-2.0.0.pom
Download https://plugins.gradle.org/m2/org/eclipse/jetty/jetty-util/8.1.8.v20121106/jet
ty-util-8.1.8.v20121106.pom
Download https://plugins.gradle.org/m2/org/eclipse/jetty/jetty-project/8.1.8.v20121106/
jetty-project-8.1.8.v20121106.pom
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-loader-tool
s/1.5.4.RELEASE/spring-boot-loader-tools-1.5.4.RELEASE.pom
Download https://plugins.gradle.org/m2/org/eclipse/jetty/jetty-parent/20/jetty-parent-2
0.pom
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-tools/1.5.4
.RELEASE/spring-boot-tools-1.5.4.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-parent/1.5.
4.RELEASE/spring-boot-parent-1.5.4.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-dependencie
s/1.5.4.RELEASE/spring-boot-dependencies-1.5.4.RELEASE.pom
Download https://plugins.gradle.org/m2/com/fasterxml/jackson/jackson-bom/2.8.8/jackson-
bom-2.8.8.pom
Download https://plugins.gradle.org/m2/com/fasterxml/jackson/jackson-parent/2.8/jackson
-parent-2.8.pom
Download https://plugins.gradle.org/m2/com/fasterxml/oss-parent/27/oss-parent-27.pom
Download https://plugins.gradle.org/m2/org/apache/logging/log4j/log4j-bom/2.7/log4j-bom
-2.7.pom
Download https://plugins.gradle.org/m2/org/springframework/spring-framework-bom/4.3.9.R
ELEASE/spring-framework-bom-4.3.9.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/data/spring-data-releasetrai
n/Ingalls-SR4/spring-data-releasetrain-Ingalls-SR4.pom
Download https://plugins.gradle.org/m2/org/springframework/data/build/spring-data-build
/1.9.4.RELEASE/spring-data-build-1.9.4.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/integration/spring-integrati
on-bom/4.3.10.RELEASE/spring-integration-bom-4.3.10.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/security/spring-security-bom
/4.2.3.RELEASE/spring-security-bom-4.2.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/codehaus/groovy/groovy/2.4.11/groovy-2.4.11.
pom
Download https://plugins.gradle.org/m2/org/codehaus/groovy/groovy-json/2.4.11/groovy-js
on-2.4.11.pom
Download https://plugins.gradle.org/m2/commons-cli/commons-cli/1.2/commons-cli-1.2.pom
Download https://plugins.gradle.org/m2/commons-configuration/commons-configuration/1.10
/commons-configuration-1.10.pom
Download https://plugins.gradle.org/m2/org/apache/commons/commons-parent/11/commons-par
ent-11.pom
Download https://plugins.gradle.org/m2/org/apache/commons/commons-lang3/3.3.2/commons-l
ang3-3.3.2.pom
Download https://plugins.gradle.org/m2/org/apache/servicemix/bundles/org.apache.service
mix.bundles.bcprov-jdk16/1.46_3/org.apache.servicemix.bundles.bcprov-jdk16-1.46_3.pom
Download https://plugins.gradle.org/m2/org/apache/commons/commons-parent/32/commons-par
ent-32.pom
Download https://plugins.gradle.org/m2/org/apache/commons/commons-parent/33/commons-par
ent-33.pom
Download https://plugins.gradle.org/m2/org/apache/servicemix/bundles/bundles-pom/8/bund
les-pom-8.pom
Download https://plugins.gradle.org/m2/org/apache/apache/13/apache-13.pom
Download https://plugins.gradle.org/m2/org/apache/servicemix/servicemix-pom/5/servicemi
x-pom-5.pom
Download https://plugins.gradle.org/m2/org/apache/apache/4/apache-4.pom
Download https://plugins.gradle.org/m2/commons-io/commons-io/2.4/commons-io-2.4.pom
Download https://plugins.gradle.org/m2/org/apache/apache/7/apache-7.pom
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-devtools/1.
3.3.RELEASE/spring-boot-devtools-1.3.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/apache/commons/commons-parent/25/commons-par
ent-25.pom
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-parent/1.3.
3.RELEASE/spring-boot-parent-1.3.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-dependencie
s/1.3.3.RELEASE/spring-boot-dependencies-1.3.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/spring-framework-bom/4.2.5.R
ELEASE/spring-framework-bom-4.2.5.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/data/spring-data-releasetrai
n/Gosling-SR4/spring-data-releasetrain-Gosling-SR4.pom
Download https://plugins.gradle.org/m2/org/springframework/data/build/spring-data-build
/1.7.4.RELEASE/spring-data-build-1.7.4.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/integration/spring-integrati
on-bom/4.2.5.RELEASE/spring-integration-bom-4.2.5.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/security/spring-security-bom
/4.0.3.RELEASE/spring-security-bom-4.0.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/spring-core/4.3.9.RELEASE/sp
ring-core-4.3.9.RELEASE.pom
Download https://plugins.gradle.org/m2/commons-lang/commons-lang/2.6/commons-lang-2.6.p
om
Download https://plugins.gradle.org/m2/commons-logging/commons-logging/1.1.1/commons-lo
gging-1.1.1.pom
Download https://plugins.gradle.org/m2/org/apache/commons/commons-parent/17/commons-par
ent-17.pom
Download https://plugins.gradle.org/m2/org/apache/commons/commons-parent/5/commons-pare
nt-5.pom
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-autoconfigu
re/1.3.3.RELEASE/spring-boot-autoconfigure-1.3.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot/1.3.3.RELEA
SE/spring-boot-1.3.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/spring-context/4.2.5.RELEASE
/spring-context-4.2.5.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/spring-expression/4.2.5.RELE
ASE/spring-expression-4.2.5.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/spring-aop/4.2.5.RELEASE/spr
ing-aop-4.2.5.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/spring-beans/4.2.5.RELEASE/s
pring-beans-4.2.5.RELEASE.pom
Download https://plugins.gradle.org/m2/aopalliance/aopalliance/1.0/aopalliance-1.0.pom
Download https://plugins.gradle.org/m2/commons-logging/commons-logging/1.2/commons-logg
ing-1.2.pom
Download https://plugins.gradle.org/m2/org/apache/commons/commons-parent/34/commons-par
ent-34.pom
Download https://plugins.gradle.org/m2/gradle/plugin/org/akhikhl/gretty/gretty/2.0.0/gr
etty-2.0.0.jar
Download https://plugins.gradle.org/m2/org/akhikhl/gretty/gretty-core/2.0.0/gretty-core
-2.0.0.jar
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-loader-tool
s/1.5.4.RELEASE/spring-boot-loader-tools-1.5.4.RELEASE.jar
Download https://plugins.gradle.org/m2/org/eclipse/jetty/jetty-util/8.1.8.v20121106/jet
ty-util-8.1.8.v20121106.jar
Download https://plugins.gradle.org/m2/org/codehaus/groovy/groovy/2.4.11/groovy-2.4.11.
jar
Download https://plugins.gradle.org/m2/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
Download https://plugins.gradle.org/m2/commons-configuration/commons-configuration/1.10
/commons-configuration-1.10.jar
Download https://plugins.gradle.org/m2/commons-io/commons-io/2.4/commons-io-2.4.jar
Download https://plugins.gradle.org/m2/org/apache/commons/commons-lang3/3.3.2/commons-l
ang3-3.3.2.jar
Download https://plugins.gradle.org/m2/org/apache/servicemix/bundles/org.apache.service
mix.bundles.bcprov-jdk16/1.46_3/org.apache.servicemix.bundles.bcprov-jdk16-1.46_3.jar
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-autoconfigu
re/1.3.3.RELEASE/spring-boot-autoconfigure-1.3.3.RELEASE.jar
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-devtools/1.
3.3.RELEASE/spring-boot-devtools-1.3.3.RELEASE.jar
Download https://plugins.gradle.org/m2/org/springframework/spring-context/4.2.5.RELEASE
/spring-context-4.2.5.RELEASE.jar
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot/1.3.3.RELEA
SE/spring-boot-1.3.3.RELEASE.jar
Download https://plugins.gradle.org/m2/org/springframework/spring-aop/4.2.5.RELEASE/spr
ing-aop-4.2.5.RELEASE.jar
Download https://plugins.gradle.org/m2/org/springframework/spring-beans/4.2.5.RELEASE/s
pring-beans-4.2.5.RELEASE.jar
Download https://plugins.gradle.org/m2/org/springframework/spring-expression/4.2.5.RELE
ASE/spring-expression-4.2.5.RELEASE.jar
Download https://plugins.gradle.org/m2/org/springframework/spring-core/4.3.9.RELEASE/sp
ring-core-4.3.9.RELEASE.jar
Download https://plugins.gradle.org/m2/commons-logging/commons-logging/1.2/commons-logg
ing-1.2.jar
Download https://plugins.gradle.org/m2/commons-lang/commons-lang/2.6/commons-lang-2.6.j
ar
Download https://plugins.gradle.org/m2/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
Download https://plugins.gradle.org/m2/org/codehaus/groovy/groovy-json/2.4.11/groovy-js
on-2.4.11.jar
Download https://jcenter.bintray.com/javax/websocket/javax.websocket-api/1.0/javax.webs
ocket-api-1.0.pom
Download https://jcenter.bintray.com/javax/servlet/jsp/jsp-api/2.1/jsp-api-2.1.pom
Download https://jcenter.bintray.com/javax/servlet/servlet-api/2.5/servlet-api-2.5.pom
Download https://jcenter.bintray.com/javax/servlet/javax.servlet-api/3.1.0/javax.servle
t-api-3.1.0.pom
Download https://jcenter.bintray.com/javax/websocket/javax.websocket-all/1.0/javax.webs
ocket-all-1.0.pom
Download https://jcenter.bintray.com/net/java/jvnet-parent/3/jvnet-parent-3.pom
Download https://jcenter.bintray.com/net/java/jvnet-parent/4/jvnet-parent-4.pom
Download https://jcenter.bintray.com/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar
Download https://jcenter.bintray.com/javax/websocket/javax.websocket-api/1.0/javax.webs
ocket-api-1.0.jar
Download https://jcenter.bintray.com/javax/servlet/jsp/jsp-api/2.1/jsp-api-2.1.jar
Download https://jcenter.bintray.com/javax/servlet/javax.servlet-api/3.1.0/javax.servle
t-api-3.1.0.jar
Download https://jcenter.bintray.com/javax/servlet/jstl/1.1.2/jstl-1.1.2.pom
Download https://jcenter.bintray.com/taglibs/standard/1.1.2/standard-1.1.2.pom
Download https://jcenter.bintray.com/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar
Download https://jcenter.bintray.com/taglibs/standard/1.1.2/standard-1.1.2.jar
BUILD SUCCESSFUL in 1m 5s
2 actionable tasks: 2 executed

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *