Jaini Naveen
Jaini Naveen

Reputation: 165

Gradle gretty jetty not working in Debug

I am using the Windows OS, JDK 1.7, Gradle 3.0, IDE Eclipse mars and jetty 8.1.5.v20120716.

Note: I am using gretty plugin too

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
}

The behavior is same in all the options which I have tried, it is just hanging there at the port 5005 statement, it is not even loading the application also. I am using Spring annotation based and class type we initializer "AbstractAnnotationConfigDispatcherServletInitializer"

I tried in the following options. appStartDebug, appRunDebug, jettyStartDebug and 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

Please someone help me on this issue.

Upvotes: 3

Views: 2602

Answers (2)

sirandy
sirandy

Reputation: 1838

You must create a remote debug session.

In eclipse: Run > Debug Configuration > Remote Java Application Then right clic and create New. Don't launch yet.

Remote Debug

Then go the console and start your project with: gradle jettyRunDebug, when it stops on "Listening for transport dt_socket at address: 5005", there launch your debug since IDE, with the configuration previously created.

It must go into debug mode.

Upvotes: 5

lance-java
lance-java

Reputation: 27976

Remove the debug options from %GRADLE_OPTS% and do

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

See StartBaseTask.groovy and AppStartTask.groovy

Upvotes: 0

Related Questions