IDEA debugger and Gradle dependsOn

Just bumped into an issue that may cause others heartburn.

In Gradle, we have defined integration test source set. We defined the integrationTest task like this:

task integrationTest(type: Test, dependsOn: 'test’)

The thinking was, we want the unit tests to run before the integration tests.

When the IDEA 14.1.5 debugger starts to run the integration tests, we get an error that contains lines like these:

FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)

ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)

JDWP exit error

It looks like IDEA opens a debugger port at the start, executes the unit tests, then closes the port. By the time the integration tests run, the port's not open and it causes that error.

The workaround is to not use that dependsOn in the integrationTest task definition. I tried adding

integrationTest.mustRunAfter test

to the build file, but the unit tests are not being executed in Run or Debug mode. At least the error is not occurring in debug.

Hope this helps anyone who bumps into the same issue.


Please sign in to leave a comment.