# Debug custom elasticsearch plugin in Intellij

**URL:** <https://discuss.elastic.co/t/debug-custom-elasticsearch-plugin-in-intellij/197145>\
**Category:** Elasticsearch\
**Created:** [August 28, 2019, 3:04pm UTC](https://discuss.elastic.co/t/debug-custom-elasticsearch-plugin-in-intellij/197145 "2019-08-28T15:04:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deb/32/46162_2.png) [@Deb](https://discuss.elastic.co/u/Deb)\
**Post date:** [August 28, 2019, 3:04pm UTC](https://discuss.elastic.co/t/debug-custom-elasticsearch-plugin-in-intellij/197145/1 "2019-08-28T15:04:08Z")

</div>

I have gone through this [blog](https://www.elastic.co/blog/how-to-debug-elasticsearch-source-code-in-intellij-idea) and I am able to debug elasticsearch code in Intellij.

Can someone let me know how can I debug a custom plugin code in Intellij now? I have gone through this [post](https://discuss.elastic.co/t/how-can-i-debug-a-plugin-in-an-ide/56893/2) and tried to run elasticsearch

```auto
./gradlew :plugins:/code/github/vnera/main/es-plugins/dedup/target/releases/dedup-0.001-SNAPSHOT.zip:run --debug-jvm

```

But it failed with the below error

```auto
Project '/code/github/vnera/main/es-plugins/dedup/target/releases/dedup-0.001-SNAPSHOT.zip' not found in project ':plugins'.

```

I also tried doing

```auto
./gradlew :plugins:file:/code/github/vnera/main/es-plugins/dedup/target/releases/dedup-0.001-SNAPSHOT.zip:run --debug-jvm

```

But still it failed with the below error

```auto
Project 'file' not found in project ':plugins'.

```

Can someone let me know how can I debug a custom elasticsearch plugin code in Intellij?

For custom plugin I am using maven .

---

<div class="post-metadata">

**Author:** ![Deb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deb/32/46162_2.png) [@Deb](https://discuss.elastic.co/u/Deb)\
**Post date:** [August 28, 2019, 5:53pm UTC](https://discuss.elastic.co/t/debug-custom-elasticsearch-plugin-in-intellij/197145/2 "2019-08-28T17:53:59Z")

</div>

By following the instruction mentioned in [TESTING.asciidoc](https://github.com/elastic/elasticsearch/blob/master/TESTING.asciidoc#debugging-remotely-from-an-ide) I am also able to connect to the remote elastic search from intellij.

But I am still not able to figure out how can I step through my plugin code that is running inside the remote elasticsearch.

Can someone suggest something?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 29, 2019, 7:51am UTC](https://discuss.elastic.co/t/debug-custom-elasticsearch-plugin-in-intellij/197145/3 "2019-08-29T07:51:24Z")

</div>

if you are using gradle, you can start your plugin with `./gradlew run --debug-jvm`, before the java process starts, you need to attach intellij and then you can step debug through the code by triggering executions (be it an HTTP request, or a cluster state listener or a query).

---

<div class="post-metadata">

**Author:** ![Deb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deb/32/46162_2.png) [@Deb](https://discuss.elastic.co/u/Deb)\
**Post date:** [August 29, 2019, 8:16am UTC](https://discuss.elastic.co/t/debug-custom-elasticsearch-plugin-in-intellij/197145/4 "2019-08-29T08:16:27Z")

</div>

Yes it is working what you have suggested. Can you let me know how can I do `--debug-jvm` with custom plugin?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 29, 2019, 9:24am UTC](https://discuss.elastic.co/t/debug-custom-elasticsearch-plugin-in-intellij/197145/5 "2019-08-29T09:24:40Z")

</div>

You can call the above gradle command within your own plugin, if you are using the build-tools dependency. See [https://github.com/spinscale/elasticsearch-ingest-langdetect](https://github.com/spinscale/elasticsearch-ingest-langdetect) for an example.

---

<div class="post-metadata">

**Author:** ![Deb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deb/32/46162_2.png) [@Deb](https://discuss.elastic.co/u/Deb)\
**Post date:** [August 29, 2019, 9:53am UTC](https://discuss.elastic.co/t/debug-custom-elasticsearch-plugin-in-intellij/197145/6 "2019-08-29T09:53:11Z")

</div>

My plugin is in a maven project. Will this work for maven project also?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 29, 2019, 10:26am UTC](https://discuss.elastic.co/t/debug-custom-elasticsearch-plugin-in-intellij/197145/7 "2019-08-29T10:26:08Z")

</div>

No, those buildtools are for gradle only as far as I know. There is a community supported [elasticsearch maven plugin](https://github.com/alexcojocaru/elasticsearch-maven-plugin), but I have never used it and cannot comment on it further.

---

<div class="post-metadata">

**Author:** ![Deb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deb/32/46162_2.png) [@Deb](https://discuss.elastic.co/u/Deb)\
**Post date:** [August 29, 2019, 12:28pm UTC](https://discuss.elastic.co/t/debug-custom-elasticsearch-plugin-in-intellij/197145/8 "2019-08-29T12:28:51Z")

</div>

Thanks @spinscale for your suggestions.

---

<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:** [September 26, 2019, 12:38pm UTC](https://discuss.elastic.co/t/debug-custom-elasticsearch-plugin-in-intellij/197145/9 "2019-09-26T12:38:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
