# How to install a custom elasticsearch plugin IntelliJ locally and debug

**URL:** https://discuss.elastic.co/t/how-to-install-a-custom-elasticsearch-plugin-intellij-locally-and-debug/195970
**Category:** Elasticsearch
**Created:** [August 20, 2019, 4:05pm UTC](https://discuss.elastic.co/t/how-to-install-a-custom-elasticsearch-plugin-intellij-locally-and-debug/195970 "2019-08-20T16:05:56Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![zcharli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zcharli/32/52338_2.png) [@zcharli](https://discuss.elastic.co/u/zcharli)
#### Post date: [August 20, 2019, 4:05pm UTC](https://discuss.elastic.co/t/how-to-install-a-custom-elasticsearch-plugin-intellij-locally-and-debug/195970/1 "2019-08-20T16:05:56Z")

</div>

I've got java 12 running on my Mac, I've checked out the 6.7 branch from github and was able to successfully build and launch the project with `./gradlew run --debug-jvm`. I've managed to put a breakpoint against my local ES. My goal is to put a breakpoint in a custom elasticsearch plugin for version (6.7.1) in my Intellij. I believe if I can install my plugin successfully, I can attach to my local ES instance and hit any break points in my plugin.

I have access to my plugin source code, which I have built in a zip file. How should I install this plugin against my local cluster?

I've tried to use the elasticsearch-plugin script under the distribution/src/bin folder to install but it fails with `Error: Could not find or load main class org.elasticsearch.tools.java_version_checker.JavaVersionChecker`. This class probably would not work anyways because my java home is not set to 8 because I need 12 to build the project.

---

<div class="post-metadata">

### Author: ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)
#### Post date: [August 20, 2019, 5:15pm UTC](https://discuss.elastic.co/t/how-to-install-a-custom-elasticsearch-plugin-intellij-locally-and-debug/195970/2 "2019-08-20T17:15:54Z")

</div>

How are you building your plugin? If you use Gradle with Elasticsearch's `build-tools` jar, which provides the Gradle `elasticsearch.esplugin` plugin, you can use `gradle run --debug-jvm` within your project to setup and run Elasticsearch with your plugin for debugging.

---

<div class="post-metadata">

### Author: ![zcharli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zcharli/32/52338_2.png) [@zcharli](https://discuss.elastic.co/u/zcharli)
#### Post date: [August 20, 2019, 6:02pm UTC](https://discuss.elastic.co/t/how-to-install-a-custom-elasticsearch-plugin-intellij-locally-and-debug/195970/3 "2019-08-20T18:02:07Z")

</div>

Yes I am using build-tools, and I ran that within my plugin source and it worked. Do you have any additional documentation for what build-tools is capable of? I had been zipping up my own jars prior to this.

Many thanks.

---

<div class="post-metadata">

### Author: ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)
#### Post date: [August 21, 2019, 12:27am UTC](https://discuss.elastic.co/t/how-to-install-a-custom-elasticsearch-plugin-intellij-locally-and-debug/195970/4 "2019-08-21T00:27:09Z")

</div>

Unfortunately there is not yet any documentation for build-tools, but it is something we plan to add. Your best bet is to look at other build.gradle files within the Elasticsearch project, or look at the source code within buildSrc of Elasticsearch.

---

<div class="post-metadata">

### Author: ![zcharli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zcharli/32/52338_2.png) [@zcharli](https://discuss.elastic.co/u/zcharli)
#### Post date: [August 21, 2019, 1:48am UTC](https://discuss.elastic.co/t/how-to-install-a-custom-elasticsearch-plugin-intellij-locally-and-debug/195970/5 "2019-08-21T01:48:32Z")

</div>

Would you happen to know what assemble task packages the plugin lib dependencies into the distribution zip file for installation? My dependencies aren’t built into there but I’ve pulled an example plugin project and got that to work. They didn’t do anything special in their build.gradle so I suspect there is something not right with my project.

I'm having issues including the following into my project. These dependencies are also in the ES project. Could there be an issue to package transitive deps? I can include any other dependencies in the zip, just not these ones.

```auto
compile 'org.apache.httpcomponents:httpclient:4.5.2'
compile(group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.5')
compile(group: 'commons-logging', name: 'commons-logging', version: '1.1.3')

```

Edit: Having this at the bottom of my dependencies task broke it.... I don't know why.

```auto
  compileOnly "org.elasticsearch.plugin:x-pack-core:6.7.1"

```

---

<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 18, 2019, 1:48am UTC](https://discuss.elastic.co/t/how-to-install-a-custom-elasticsearch-plugin-intellij-locally-and-debug/195970/6 "2019-09-18T01:48:37Z")

</div>

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