【问题标题】:Gradle gretty jetty not working in DebugGradle gretty jetty 在调试中不起作用
【发布时间】:2016-09-22 04:47:50
【问题描述】:

我使用的是 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
}

我尝试过的所有选项的行为都是相同的,它只是挂在端口 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

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

【问题讨论】:

    标签: java spring-mvc gradle jetty gretty


    【解决方案1】:

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

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

    然后转到控制台并使用以下命令启动您的项目:gradle jettyRunDebug,当它在“Listening for transport dt_socket at address: 5005”处停止时,将使用之前创建的配置从 IDE 启动您的调试。

    它必须进入调试模式。

    【讨论】:

    • 非常感谢,现在它正在工作。你真的让我很开心。
    【解决方案2】:

    %GRADLE_OPTS% 中删除调试选项并执行

    gretty {
        debug = true
        debugSuspend = false
        debugPort = 9999
        ...
    }
    

    StartBaseTask.groovyAppStartTask.groovy

    【讨论】:

      猜你喜欢
      • 2023-03-02
      • 2015-10-05
      • 2019-11-10
      • 1970-01-01
      • 1970-01-01
      • 2018-10-11
      • 2013-12-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多