# How can I debug a plugin in an IDE?

**URL:** <https://discuss.elastic.co/t/how-can-i-debug-a-plugin-in-an-ide/56893>\
**Category:** Elasticsearch\
**Created:** [August 1, 2016, 1:22pm UTC](https://discuss.elastic.co/t/how-can-i-debug-a-plugin-in-an-ide/56893 "2016-08-01T13:22:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adityasinghraghav](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@adityasinghraghav](https://discuss.elastic.co/u/adityasinghraghav)\
**Post date:** [August 1, 2016, 1:22pm UTC](https://discuss.elastic.co/t/how-can-i-debug-a-plugin-in-an-ide/56893/1 "2016-08-01T13:22:12Z")

</div>

I used `gradle idea` to import the elasticsearch source to IntelliJ and now can run and debug the source. Now I want to start my elasticsearch instance in IntelliJ with a plugin installed(for instance the `jvm-example` from master) in the same project. How can i do this ?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [August 1, 2016, 1:42pm UTC](https://discuss.elastic.co/t/how-can-i-debug-a-plugin-in-an-ide/56893/2 "2016-08-01T13:42:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:31pm UTC](https://discuss.elastic.co/t/how-can-i-debug-a-plugin-in-an-ide/56893/3 "2017-07-05T22:31:13Z")

</div>


