2016-06-20 96 views
3

我想了解ES如何工作,但是我無法從IDE運行它。我想運行仍然使用Maven作爲其構建系統的2.3.3構建版本,但仍然出現錯誤。有人可以告訴我,在我詳細下載存儲庫後,我可以如何在IDEA中執行此操作。配置等如何在IntelliJ IDEA中設置並運行/調試ElasticSearch

我下載庫從GitHub,然後我導入項目進入的IntelliJ 和使用以下配置:

主要類:org.elasticsearch.bootstrap.Elasticsearch

VM選項:

-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 

工作目錄:ES目錄

環境變量:模塊的ES_TEST_LOCAL =真

使用類路徑:elasticsearch(1)(org.elasticsearch)

,然後我收到以下錯誤,當我嘗試運行:

error

+1

你檢查了嗎? https://github.com/elastic/elasticsearch/blob/2.3/CONTRIBUTING.md#contributing-to-the-elasticsearch-codebase – Val

+0

什麼錯誤?建設和運行是兩回事。 – duffymo

+0

我嘗試使用eclipse,但是當我使用 - > mvn eclipse:eclipse時,我不斷收到以下錯誤:無法執行目標項目分佈:無法解析項目org.elasticsearch.distribution的依賴關係:分佈:pom:2.3.3 -SNAPSHOT:以下工件無法解析:org.elasticsearch:elasticsearch:jar:tests:2.3.3-SNAPSHOT,org.elasticsearch:elasticsearch:jar:2.3.3-SNAPSHOT:找不到org.elasticsearch:elasticsearch: jar:測試:2.3.3-SNAPSHOT在https://oss.sonatype.org/content/repositories/snapshots/被緩存在本地存儲庫中, – adityasinghraghav

回答

2

先決條件:

  1. 構建根項目:MVN清潔套裝-DskipTests(或執行run.sh)
  2. 將./distribution/src/main/resources/config複製到./core/。

創建運行/調試配置如下:

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

注意5.x行不使用maven,它使用gradle –

5

對於5.x的 - 從命令行:

> gradle run --debug-jvm 
Running elasticsearch in debug mode, suspending until connected on port 8000 
[elasticsearch] Listening for transport dt_socket at address: 8000 

從的Intellij,創建遠程調試配置和設置端口到8000. enter image description here

+0

而已?那麼你在那之後運行一個節點? – Jonathan

+0

@喬納森,是的,就是這樣。一個節點將會運行。 –

相關問題