adityasinghraghav adityasinghraghav - 1 month ago 11
Java Question

How can I setup and run/debug ElasticSearch in IntelliJ IDEA

I am trying to learn how ES works however I haven't been able to run it from an IDE. I want to run the 2.3.3 build which still uses Maven as its build system but keep getting errors. Can someone tell me how I can do this in IDEA after I download the repository in detail ie. the configuration etc.

I downloaded the repository from github, then I imported the project into intellij
and used the following configurations:

Main class: org.elasticsearch.bootstrap.Elasticsearch

Vm options:

-Xms256m
-Xmx1g
-Xss256k
-Djava.awt.headless=true
-XX:+UseParNewGC
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=logs/heapdump.hprof
-Delasticsearch
-Des.foreground=yes
-Djava.library.path=lib/sigar
-ea
-Des.config=C:\elasticsearch-2.3.3\core\src\test\resources\config\elasticsearch.yaml>/elasticsearch.yml
-Des.logger.level=DEBUG
-Des.path.home=C:\elasticsearch-2.3.3


working directory: ES directory

environment variable: ES_TEST_LOCAL=true

use classpath of module: elasticsearch(1)(org.elasticsearch)

and then I get the following errors when i try to run:

error

Answer

Pre-requisites:

  1. Build the root project : mvn clean package -DskipTests (or execute run.sh)
  2. copy ./distribution/src/main/resources/config to ./core/.

Create a Run/Debug configuration as follows:

Main Class: org.elasticsearch.bootstrap.Elasticsearch   
VM Options: -Des.path.home=/code/elasticsearch/core   
Program Arguments: start   
Classpath of Module : [select the core project]   
Comments