Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
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 https://github.com/sscarduzio/elasticsearch-readonlyrest-plugin.git /me/elasticsearch-readonlyrest-plugin
For this example, we cloned the source code under a short path: the
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.."
Click the plus icon on the left and create a new "Application". Now fill in all the fields as shown in the pic:
-Djava.security.policy=/me/elasticsearch-readonlyrest-plugin/src/main/resources/plugin-security.policy -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
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-descriptor.properties └── 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.
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.
If you try to run
Whole ES and you get
jar hell related errors, refer to this issue: https://github.com/elastic/elasticsearch/issues/14348 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.