How can I debug a plugin in an IDE?

There are actually 5 options I can think of:

  1. Write a unit test (extends ESTestCase). These run in your IDE no problem.
  2. Write a semi-integration test (extends ESIntegTestCase). There also run in your IDE no problem.
  3. Use gradle run --debug-jvm. For jvm-example you need to do gradle :plugins:jvm-example:run --debug-jvm. That will start Elasticsearch for remote debugging and wait until something connects on port 8000. You can just interact with Elasticsearch with CURL.
  4. Write an integration test (extends ESRestTestCase). These run in your IDE by first starting Elasticsearch like in step 3 and adding -Dtests.rest.cluster=localhost:9200 to the VM arguments for the test.
  5. Run all the integration tests with --debug-jvm. It looks like gradle :plugins:jvm-example:integTest --debug-jvm. This is just like number 3 except it kicks off the integration tests as soon as you unblock Elasticsearch.
1 Like