How to install a custom elasticsearch plugin IntelliJ locally and debug

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.

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.

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.

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.

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.

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.

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

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