Failing to run on Intellij in debug mode

Hi,

I followed the instruction, provided CONTRIBUTING.md and TESTING.asciidoc, to setup Elasticsearch on Intellij (macOS 10.15.4) . I was able to run it normal mode but I am unable to run it in debug mode.

This worked: ./gradlew run
But failed to run with following error: ./gradlew run --debug-jvm

> Task :distribution:run FAILED
Running elasticsearch in debug mode, node{:distribution:runTask-0} suspending until connected on debugPort 5005
Exec output and error:
| Output for ./bin/elasticsearch-keystore:ERROR: transport error 202: connect failed: Connection refused
| ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
| JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [:732]

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':distribution:run'.
> Process 'command './bin/elasticsearch-keystore'' finished with non-zero exit value 2

System Config:

=======================================
Elasticsearch Build Hamster says Hello!
  Gradle Version        : 6.3
  OS Info               : Mac OS X 10.15.4 (x86_64)
  Compiler JDK Version  : 14 (AdoptOpenJDK)
  Compiler java.home    : /Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk/Contents/Home
  Runtime JDK Version   : 11 (Oracle JDK)
  Runtime java.home     : /Library/Java/JavaVirtualMachines/jdk-11.0.4.jdk/Contents/Home
  Gradle JDK Version    : 14 (AdoptOpenJDK)
  Gradle java.home      : /Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk/Contents/Home
  Random Testing Seed   : FE1157C27A452AC1
  In FIPS 140 mode      : false
=======================================

What am I missing? Is some kind of keystore to setup? I would appreciate your help on this.

Regards,
Amit

May be @MarkVieira could help?

Your debug run configuration in IntelliJ needs two main items configured for it to work well with the :run task.

  1. It needs to use "listen" mode instead of the default "attach".
  2. "Auto restart" needs to be enabled.

The config should look something like this:

Importing the project should have set this up for you however.

Yes, it was setup though its failing.

You'll need to ensure you launch the IntelliJ debug run configuration before running the :run task.

Thank you mark. I appreciate your help. This is really helped me. The trick is to start Intellij debug before :run.