Simone Scarduzio edited this page Sep 6, 2016 · 2 revisions

Development setup for readonly rest plugin

These instructions are valid to run the whole ElasticSearch code base as a Java application in your IDE. Additionally, we'll see how to hook up the plugin source code, so we'll be able to debug line by line an instance of ElasticSearch with a plugin installed (as source code).

Clone readonly rest plugin

This project contains the ElasticSearch dependencies in the Maven build system, so all the ElasticSearch classes will be in the class path and we'll be able to run the whole thing without a problem.

git clone /me/elasticsearch-readonlyrest-plugin

For this example, we cloned the source code under a short path: the /me directory.

Run ES as a Java Application

Open IntelliJ Idea and open the source folder as a maven project. The dependencies will be downloaded automatically. Now click on the drop down menu on the left of the green play icon on the top right and select "Edit Configurations.." Dropdown edit configurations

Click the plus icon on the left and create a new "Application". Now fill in all the fields as shown in the pic: IntelliJ Idea Run Configuration

That is:

  • Java Options -Djava.awt.headless=true -Des.insecure.allow.root=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Des.path.home=/me/elasticsearch-readonlyrest-plugin/src/test/eshome

  • Main class org.elasticsearch.bootstrap.Elasticsearch

  • Program Arguments start

The careful reader may already have noticed that the last Java option points to a special folder under src/main/test/eshome. This contains what ElasticSearch normally expects to see in the present working directory it's being run.

$ tree eshome
├── bin
│   └── no_delete
├── config
│   ├── elasticsearch.yml
│   ├── logging.yml
│   └── scripts
├── data
├── lib
│   └── no_delete
├── logs
├── modules
└── plugins
    └── readonlyrest
        └── plugin-security.policy

Notice the plugins/readonlyrest contains a copy of the descriptor properties and security policy, but not the plugin's jar. This is because the plugin code is because - as stated in the beginning - the plugin code is already available to the class path in form of source files.

Run it

Now save this, call it with a name like Whole ES and you'll be able to press play and see ElasticSearch boot up in your IDE.

ES booting up and running in IDE


If you try to run Whole ES and you get jar hell related errors, refer to this issue: The explanation will guide you through on how to remove ant-javafx.jar from the SDK classpath.

Solving this SDK issue will also address the issue of when the IDE won't find some imports (but maven still can and builds correctly). At least for me it did.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.