I'm following the Udacity App Engine course but as the tinker, I'm following using Gradle and IDEA (Open Source edition).
I have setup the project successfully using the following build.gradle file
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.7'
}
}
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = 1.8
version = '1.0'
appengine {
daemon = true
downloadSdk = true
appcfg {
oauth2 = true
}
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.7'
compile 'com.google.inject:guice:3.0'
compile 'com.googlecode.objectify:objectify:5.0.3'
compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.7'
compile 'com.google.appengine:appengine-endpoints:1.9.7'
compile 'javax.servlet:servlet-api:2.5'
compile 'javax.inject:javax.inject:1'
testCompile 'junit:junit:4.11'
testCompile 'com.google.appengine:appengine-testing:1.9.7'
testCompile 'com.google.appengine:appengine-api-stubs:1.9.7'
}
I am running the local dev server from IDEA using a Gradle run configuration with the appengineRun
configuration and stopping it using another task for appengineStop
. This is working, but I have no ability to debug as the breakpoints I put are not hit.
I believe this issue with breakpoints is because IDEA has no idea (I am horrible at puns) that it has to hook into the jetty server that backs the AppEngine server, but this is a wild shot as I have no knowledge of IDEA's internals, much less of how it handles Gradle executions.
How can I regain breakpoint ability? Is it feasible without a custom plugin?
First you have to set the JVM debug parameters in your
build.gradle
file so that you are able to debug the local development server remotely.Then you need to create a run/debug configuration in IntelliJ IDEA (based on the above parameters) to be used for remote running or debugging processes. Remote running/debugging enables you to connect to a running JVM.
You can find more details here. But basically go to the Run / Edit Configurations..., in the dialog box click on Add New Configuration (+) and select Remote. Make sure that the configuration matches JVM flags (especially port). Save and close the dialog box.
Start your local development server and connect debugger (Run / Debug).