Running two instances of gradle at same time results in bind exception

I am trying to run 2 gradle instances at the same time. First instance starts a server (project 1). Second instance I’m simply doing a build (project 2).

ERROR: transport error 202: bind failed: Address already in use ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized […/…/…/src/share/back/debugInit.c:690] FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197) Abort trap: 6

I assume gradle uses a port for something? Do I need to make a port unique for each gradle instance.

As far as I know, the only built-in Gradle Plugin that binds to a fixed port is the ‘Jetty Plugin’, which can be configured with the ‘httpPort’ property. Other candidates would be a ‘Test’ task configured with ‘debug=true’ or a ‘ScalaCompile’ task configured to use the compiler daemon with a fixed port.

Without a full stack trace it’s pretty hard to know what problem you’re hitting.

To me, this looks like someone enabled debugging on Gradle by passing JVM args like so:

'-Xdebug -Xrunjdwp:transport=dt_socket,address=8011 ,server=y,suspend=n ’

This could be solved by setting a different port on the second Gradle instance.