idea导入ES源码踩坑历程

github拉取代码

git clone https://github.com/elastic/elasticsearch.git

git checkout v5.4.1 //检出需要的版本

安装jdk

安装gradle

注意:gradle版本和ES版本对应,过低和过高都会导致后面执行gradle idea构建项目报错

进入检下来的代码目录

目录执行:gradel idea

等待。。。

出现BUILD SUCCESS即为完成

打开IDEA导入项目

open->选择build.gradle->open as project ...

修改maven仓库url

目的是为了加速jar包下载,不改下载速度极慢,甚至直接报错

benchmarks/build.gradle
distribution/build.gradle
 repositories {
        maven {
            url 'http://maven.aliyun.com/nexus/content/groups/public/'
        }
    }

启动org.elasticsearch.bootstrap.Elasticsearch下的main方法

启动前添加VM options如下:

-Des.path.home=E:\ES-Code\elasticsearch-5.4.1
-Des.path.conf=E:\ES-Code\elasticsearch-5.4.1\config
-Dfile.encoding=UTF-8

-Dfile.encoding=UTF-8:解决控制台乱码问题
后面加载plugins/modules等目录都会在home目录下加载

连接

localhost:9200

posted @ 2019-10-29 17:28  学仰泳的鱼  阅读(660)  评论(0)    收藏  举报