Gradle gretty jetty 无法在调试中工作

Jai*_*een 3 java jetty spring-mvc gradle gretty

我使用的是 Windows 操作系统、JDK 1.7、Gradle 3.0、IDE Eclipse mars 和 jetty 8.1.5.v20120716。

注意:我也在使用 gretty 插件

gretty {
    port = http_port
    host = '127.0.0.1'
    contextPath = ''
    classPath = sourceSets.main.resources.srcDirs
    servletContainer = 'jetty9' //tomcat7 or tomcat8
     httpPort = 8081 
     servicePort = 8082 
     statusPort = 8083
}
Run Code Online (Sandbox Code Playgroud)

我尝试过的所有选项的行为都是相同的,它只是挂在端口 5005 语句处,甚至没有加载应用程序。我正在使用基于 Spring 注解的类类型,我们初始化程序“AbstractAnnotationConfigDispatcherServletInitializer”

我尝试了以下选项。appStartDebug、appRunDebug、jettyStartDebug 和 jettyRunDebug。

C:\project>echo %GRADLE_OPTS%
-Xdebug -Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=n

C:\project>gradle jettyStartDebug
Listening for transport dt_socket at address: 9999
Starting a Gradle Daemon, 10 busy and 19 stopped Daemons could not be reused, use --status for details
'5e5ca94'
:prepareInplaceWebAppFolder UP-TO-DATE
:createInplaceWebAppFolder UP-TO-DATE
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:prepareInplaceWebAppClasses UP-TO-DATE
:prepareInplaceWebApp UP-TO-DATE
:jettyStartDebug
Listening for transport dt_socket at address: 5005
Run Code Online (Sandbox Code Playgroud)

请有人帮助我解决这个问题。

sir*_*ndy 5

您必须创建远程调试会话。

在 Eclipse 中:运行 > 调试配置 > 远程 Java 应用程序 然后右键单击并创建 New。还不启动。

远程调试

然后进入控制台并使用以下命令启动您的项目:gradle jettyRunDebug,当它停止在“侦听地址:5005 处的传输 dt_socket”时,将使用之前创建的配置从 IDE 启动调试。

它必须进入调试模式。