我的書 '搖籃行動' 頁面下67試圖撥打:TaskExecutionException爲gradle這個jettyRun
$ gradle jettyRun
...
* What went wrong:
Execution failed for task ':jettyRun'.
> org/eclipse/jetty/http/HttpField
...
隨着--stacktrace
選項我得到了以下信息:
...
* Exception is:
org.gradle.api.tasks.TaskExecutionException:Execution failed for task ':jettyRun'
...
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.http.HttpField
...
我的項目是todo-webapp
按照書中第67頁:
$ tree
├── build.gradle
├── src
│ └── main
│ ├── java
│ │ └── com
│ │ └── manning
│ │ └── gia
│ │ └── todo
│ │ ├── model
│ │ │ └── ToDoItem.java
│ │ ├── repository
│ │ │ ├── InMemoryToDoRepository.java
│ │ │ └── ToDoRepository.java
│ │ └── web
│ │ └── ToDoServlet.java
│ └── webapp
│ ├── css
│ │ ├── base.css
│ │ └── bg.png
│ ├── jsp
│ │ ├── index.jsp
│ │ └── todo-list.jsp
│ └── WEB-INF
│ └── web.xml
和我的構建文件是如下:在線
$ cat build.gradle
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'
}
以下各個線程我一直在努力的依賴添加到我的構建文件如:
jettyRun {
dependencies {
providedRuntime 'org.eclipse.jetty:jetty-http:9.4.0.RC0'
}
}
或直接的確與/usr/share/java/jetty9-http
添加runtime files(...)
罐子。這些都沒有奏效。我不太確定接下來要做什麼。任何建議,非常感謝。
編輯:如吸血鬼指出,所有我必須做的是去除apply plugin: 'jetty'
,而是繼線apply plugin: 'war'
,添加一行:
apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'
然後用gradle appRun
,而不是gradle jettyRun
。所有這些都來自gretty插件的頁面Getting started。
嗨斯文,我有一個EE動態web項目,我想用gretty插件。當我運行gradle appRun時,出現錯誤:org.eclipse.jetty.util.MultiException:多個異常 at org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:537)〜[jetty-annotations- 9.2.22.v20170606.jar:9.2.22.v20170606] 你能幫助我嗎? – Diabolus