https://github.com/elastic/elasticsearch/blob/master/CONTRIBUTING.md

不同的版本需要指定JDK

可以下载openJDK版本到服务器上,下载过程比较慢

https://jdk.java.net/archive/

export JAVA_HOME=/xxx/yyy/jdk10.xxx

/gradle assemble

执行命令后

生产的结果在distributions目录下, 启动跟自己下载的版本一样,一样会遇到权限问题,chown xxx -R 目录解决一下

.

├── archives

│   ├── build

│   │   ├── logs-hack

│   │   │   └── logs

│   │   └── plugins-hack

│   │       └── plugins

│   ├── build.gradle

│   ├── integ-test-zip

│   │   ├── build

│   │   │   ├── distributions

│   │   │   │   ├── elasticsearch-6.4.4-SNAPSHOT.pom

│   │   │   │   └── elasticsearch-6.4.4-SNAPSHOT.zip

│   │   │   ├── heapdump

│   │   │   └── publications

│   │   │       ├── nebula

│   │   │       │   └── pom-default.xml

│   │   │       └── nebulaRealPom

│   │   │           └── pom-default.xml

│   │   ├── build.gradle

│   │   └── src

│   │       └── test

│   │           └── java

│   │               └── org

│   │                   └── elasticsearch

│   │                       └── test

│   │                           └── rest

│   │                               ├── CreatedLocationHeaderIT.java

│   │                               ├── DefaultShardsIT.java

│   │                               ├── IntegTestZipClientYamlTestSuiteIT.java

│   │                               ├── NodeRestUsageIT.java

│   │                               ├── RequestsWithoutContentIT.java

│   │                               └── WaitForRefreshAndCloseTests.java

│   ├── oss-tar

│   │   ├── build

│   │   │   └── distributions

│   │   │       └── elasticsearch-oss-6.4.4-SNAPSHOT.tar.gz

│   │   └── build.gradle

│   ├── oss-zip

│   │   ├── build

│   │   │   ├── distributions

│   │   │   │   ├── elasticsearch-oss-6.4.4-SNAPSHOT.pom

│   │   │   │   └── elasticsearch-oss-6.4.4-SNAPSHOT.zip

│   │   │   └── publications

│   │   │       ├── nebula

│   │   │       │   └── pom-default.xml

│   │   │       └── nebulaRealPom

│   │   │           └── pom-default.xml

│   │   └── build.gradle

│   ├── tar

│   │   ├── build

│   │   │   └── distributions

│   │   │       └── elasticsearch-6.4.4-SNAPSHOT.tar.gz

│   │   └── build.gradle

│   └── zip

│       ├── build

│       │   ├── distributions

│       │   │   ├── elasticsearch-6.4.4-SNAPSHOT.pom

│       │   │   └── elasticsearch-6.4.4-SNAPSHOT.zip

│       │   └── publications

│       │       ├── nebula

│       │       │   └── pom-default.xml

│       │       └── nebulaRealPom

│       │           └── pom-default.xml

│       └── build.gradle

├── build

│   ├── cluster

│   │   ├── run\ node0

│   │   │   ├── cwd

│   │   │   └── elasticsearch-6.4.4-SNAPSHOT

│   │   │       ├── bin

│   │   │       │   ├── elasticsearch

│   │   │       │   ├── elasticsearch.bat

│   │   │       │   ├── elasticsearch-certgen

│   │   │       │   ├── elasticsearch-certgen.bat

│   │   │       │   ├── elasticsearch-certutil

│   │   │       │   ├── elasticsearch-certutil.bat

│   │   │       │   ├── elasticsearch-cli

│   │   │       │   ├── elasticsearch-cli.bat

es 的文档告诉大家,请不要把贡献代码作为课程的一部分,希望大家是自愿的贡献代码。同时在之前他们也说明不要为了重构而重构,因为测试,review要花费巨大的资源。如果要提交新的特性,请先开一个issue,讨论是否有必要才开始动手写代码。

Contributing as part of a class

In general Elasticsearch is happy to accept contributions that were created as part of a class but strongly advise against making the contribution as part of the class. So if you have code you wrote for a class feel free to submit it.

Please, please, please do not assign contributing to Elasticsearch as part of a class. If you really want to assign writing code for Elasticsearch as an assignment then the code contributions should be made to your private clone and opening PRs against the primary Elasticsearch clone must be optional, fully voluntary, not for a grade, and without any deadlines.

Because:

  • While the code review process is likely very educational, it can take wildly varying amounts of time depending on who is available, where the change is, and how deep the change is. There is no way to predict how long it will take unless we rush.
  • We do not rush reviews without a very, very good reason. Class deadlines aren't a good enough reason for us to rush reviews.
  • We deeply discourage opening a PR you don't intend to work through the entire code review process because it wastes our time.
  • We don't have the capacity to absorb an entire class full of new contributors, especially when they are unlikely to become long time contributors.

Finally, we require that you run ./gradlew check before submitting a non-documentation contribution. This is mentioned above, but it is worth repeating in this section because it has come up in this context.

FAILURE: Build failed with an exception.

* What went wrong:

Could not determine the dependencies of task ':x-pack:qa:full-cluster-restart:with-system-key:v5.6.15-SNAPSHOT#oldClusterTestCluster#node1.copyBwcPlugins'.

> Could not resolve all task dependencies for configuration ':x-pack:qa:full-cluster-restart:with-system-key:v5.6.15-SNAPSHOT#oldClusterTestCluster_elasticsearchBwcPlugins'.

> Could not resolve org.elasticsearch.plugin:x-pack:5.6.15-SNAPSHOT.

Required by:

project :x-pack:qa:full-cluster-restart:with-system-key

> Could not resolve org.elasticsearch.plugin:x-pack:5.6.15-SNAPSHOT.

> Unable to load Maven meta-data from https://snapshots.elastic.co/maven/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/maven-metadata.xml.

> Could not get resource 'https://snapshots.elastic.co/maven/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/maven-metadata.xml'.

> Could not GET 'https://snapshots.elastic.co/maven/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/maven-metadata.xml'.

> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

    export JAVA_HOME=/usr/share/jdk1.5.0_05
    export PATH=$JAVA_HOME/bin:$PATH
    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

    javac InstallCert.java

    java InstallCert

    执行过程中,输入1,在当前目录生成一个文件  
  手动复制到目录:$JAVA_HOME/lib/security/cacerts
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Sun Microsystems nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ import java.io.*;
import java.net.URL; import java.security.*;
import java.security.cert.*; import javax.net.ssl.*; public class InstallCert { public static void main(String[] args) throws Exception {
String host = "10.0.31.32"; //输入服务端地址
int port = 8443; //输入服务端端口 一般默认443 String p = "changeit"; //一般默认changeit
char[] passphrase = p.toCharArray(); File file = new File("jssecacerts");
if (file.isFile() == false) {
char SEP = File.separatorChar;
File dir = new File(System.getProperty("java.home") + SEP
+ "lib" + SEP + "security");
file = new File(dir, "jssecacerts");
if (file.isFile() == false) {
file = new File(dir, "cacerts");
}
}
System.out.println("Loading KeyStore " + file + "...");
InputStream in = new FileInputStream(file);
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(in, passphrase);
in.close(); SSLContext context = SSLContext.getInstance("TLS");
TrustManagerFactory tmf =
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(ks);
X509TrustManager defaultTrustManager = (X509TrustManager)tmf.getTrustManagers()[0];
SavingTrustManager tm = new SavingTrustManager(defaultTrustManager);
context.init(null, new TrustManager[] {tm}, null);
SSLSocketFactory factory = context.getSocketFactory(); System.out.println("Opening connection to " + host + ":" + port + "...");
SSLSocket socket = (SSLSocket)factory.createSocket(host, port);
socket.setSoTimeout(10000);
try {
System.out.println("Starting SSL handshake...");
socket.startHandshake();
socket.close();
System.out.println();
System.out.println("No errors, certificate is already trusted");
} catch (SSLException e) {
System.out.println();
e.printStackTrace(System.out);
} X509Certificate[] chain = tm.chain;
if (chain == null) {
System.out.println("Could not obtain server certificate chain");
return;
} BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in)); System.out.println();
System.out.println("Server sent " + chain.length + " certificate(s):");
System.out.println();
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
MessageDigest md5 = MessageDigest.getInstance("MD5");
for (int i = 0; i < chain.length; i++) {
X509Certificate cert = chain[i];
System.out.println
(" " + (i + 1) + " Subject " + cert.getSubjectDN());
System.out.println(" Issuer " + cert.getIssuerDN());
sha1.update(cert.getEncoded());
System.out.println(" sha1 " + toHexString(sha1.digest()));
md5.update(cert.getEncoded());
System.out.println(" md5 " + toHexString(md5.digest()));
System.out.println();
} System.out.println("Enter certificate to add to trusted keystore or 'q' to quit: [1]");
String line = reader.readLine().trim();
int k;
try {
k = (line.length() == 0) ? 0 : Integer.parseInt(line) - 1;
} catch (NumberFormatException e) {
System.out.println("KeyStore not changed");
return;
} X509Certificate cert = chain[k];
String alias = host + "-" + (k + 1);
ks.setCertificateEntry(alias, cert); OutputStream out = new FileOutputStream("jssecacerts");
ks.store(out, passphrase);
out.close(); System.out.println();
System.out.println(cert);
System.out.println();
System.out.println
("Added certificate to keystore 'jssecacerts' using alias '"
+ alias + "'");
} private static final char[] HEXDIGITS = "0123456789abcdef".toCharArray(); private static String toHexString(byte[] bytes) {
StringBuilder sb = new StringBuilder(bytes.length * 3);
for (int b : bytes) {
b &= 0xff;
sb.append(HEXDIGITS[b >> 4]);
sb.append(HEXDIGITS[b & 15]);
sb.append(' ');
}
return sb.toString();
} private static class SavingTrustManager implements X509TrustManager { private final X509TrustManager tm;
private X509Certificate[] chain; SavingTrustManager(X509TrustManager tm) {
this.tm = tm;
} public X509Certificate[] getAcceptedIssuers() {
throw new UnsupportedOperationException();
} public void checkClientTrusted(X509Certificate[] chain, String authType)
throws CertificateException {
throw new UnsupportedOperationException();
} public void checkServerTrusted(X509Certificate[] chain, String authType)
throws CertificateException {
this.chain = chain;
tm.checkServerTrusted(chain, authType);
}
} }
---------------------

6.4 分支能编译,能运行起来,但是单元测试老是提示找不到 5.X的一个包,估计是拿来做兼容测试的。

=======================================
Elasticsearch Build Hamster says Hello!
=======================================
Gradle Version : 4.9
OS Info : Linux 3.10.0-862.el7.x86_64 (amd64)
JDK Version : Oracle Corporation 10.0.2 [OpenJDK 64-Bit Server VM 10.0.2+13]
JAVA_HOME : /data/dev/jdk-10.0.2
Random Testing Seed : 9DAA18E0EFB8B8EE

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':x-pack:qa:full-cluster-restart:with-system-key:v5.6.15-SNAPSHOT#oldClusterTestCluster#node1.copyBwcPlugins'.
> Could not resolve all task dependencies for configuration ':x-pack:qa:full-cluster-restart:with-system-key:v5.6.15-SNAPSHOT#oldClusterTestCluster_elasticsearchBwcPlugins'.
> Could not find org.elasticsearch.plugin:x-pack:5.6.15-SNAPSHOT.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/maven-metadata.xml
- https://repo.maven.apache.org/maven2/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/x-pack-5.6.15-SNAPSHOT.pom
- https://repo.maven.apache.org/maven2/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/x-pack-5.6.15-SNAPSHOT.zip
- https://artifacts.elastic.co/maven/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/maven-metadata.xml
- https://artifacts.elastic.co/maven/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/x-pack-5.6.15-SNAPSHOT.pom
- https://artifacts.elastic.co/maven/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/x-pack-5.6.15-SNAPSHOT.zip
- https://artifacts.elastic.co/maven/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/maven-metadata.xml
- https://artifacts.elastic.co/maven/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/x-pack-5.6.15-SNAPSHOT.pom
- https://artifacts.elastic.co/maven/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/x-pack-5.6.15-SNAPSHOT.zip
- https://snapshots.elastic.co/maven/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/maven-metadata.xml
- https://snapshots.elastic.co/maven/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/x-pack-5.6.15-SNAPSHOT.pom
- https://snapshots.elastic.co/maven/org/elasticsearch/plugin/x-pack/5.6.15-SNAPSHOT/x-pack-5.6.15-SNAPSHOT.zip
Required by:
project :x-pack:qa:full-cluster-restart:with-system-key

git check master

重新执行,发现中文的提示,导致测试用例不过。

Suite: Test class org.elasticsearch.plugins.PluginsServiceTests

1> [2019-04-30T09:42:28,120][INFO ][o.e.p.PluginsServiceTests] [testDesktopServicesStoreFiles] before test

1> [2019-04-30T09:42:28,337][INFO ][o.e.p.PluginsServiceTests] [testDesktopServicesStoreFiles] after test

2> REPRODUCE WITH: ./gradlew :server:test --tests "org.elasticsearch.plugins.PluginsServiceTests.testDesktopServicesStoreFiles" -Dtests.seed=9EA3ED2F64F1D310 -Dtests.security.manager=true -Dtests.locale=hr-BA -Dtests.timezone=EST5EDT -Dcompiler.java=12 -Druntime.java=12

2> java.lang.AssertionError:

Expected: with toString() a string containing "Not a directory"

but: toString() was "java.nio.file.FileSystemException: /data/dev/elasticsearch/server/build/testrun/test/temp/org.elasticsearch.plugins.PluginsServiceTests_9EA3ED2F64F1D310-002/tempDir-002/plugins/.DS_Store/plugin-descriptor.properties: 不是目录"

at __randomizedtesting.SeedInfo.seed([9EA3ED2F64F1D310:C91D147EEA92C17A]:0)

at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)

at org.junit.Assert.assertThat(Assert.java:956)

at org.junit.Assert.assertThat(Assert.java:923)

启动过程如果提示max file open too low可以执行这个
sudo sh -c "ulimit -n 65536 && exec su $LOGNAME"

 

elasticsearch 之编译过程的更多相关文章

  1. Android工程的编译过程

    现在很多人想对Android工程的编译和打包进行自动化,比如建立每日构建系统.自动生成发布文件等等.这些都需要我们对Android工程的编译和打包有一个深入的理解,至少要知道它的每一步都做了什么,需要 ...

  2. GCC编译过程

    以下是C程序一般的编译过程: gcc的编译流程分为四个步骤,分别为:· 预处理(Pre-Processing) 对C语言进行预处理,生成*.i文件.· 编译(Compiling) 将上一步生成的*.i ...

  3. Linux系统GCC常用命令和GCC编译过程描述

    前言: GCC 原名为 GNU C 语言编译器(GNU C Compiler),因为它原本只能处理 C语言.GCC 很快地扩展,变得可处理 C++.后来又 扩展能够支持更多编程语言,如Fortran. ...

  4. Hadoop源码编译过程

    一.           为什么要编译Hadoop源码 Hadoop是使用Java语言开发的,但是有一些需求和操作并不适合使用java,所以就引入了本地库(Native Libraries)的概念,通 ...

  5. gcc编译过程简述

    在linux系统上,从源文件到目标文件的转化是由编译器完成的.以hello.c程序的编译为例,如下: dfcao@linux: gcc -o hello hello.c 在这里,gcc编译器读取源文件 ...

  6. android 编译过程

    引用:http://www.cnblogs.com/devinzhang/archive/2011/12/20/2294686.html http://blog.sina.com.cn/s/blog_ ...

  7. [转]UE4 Blueprint编译过程

    Blueprint 编译概述   一.术语 Blueprint,像C++语言一下的,在游戏中使用前需要编译.当你在BP编辑器中,点击编译按钮时候,BP资源开始把属性和图例过程转换为一个类对象处理. 1 ...

  8. TextMate2 最新版下载及源码编译过程

    TextMate2 已经开源,我刚编译成功,如果有需要的同学可以点击下面百度网盘的链接下载.我系统版本是:Mac OS X 10.8.4. TextMate version 2.0-alpha.946 ...

  9. C语言的编译过程、安装gcc编译器以及设置环境变量

    以我对C语言编译过程的了解,我用了一点时间画了一个图,提供给大家参考一下,希望有些能对您的问题提上帮助. 前几天刚初步学习了C语言的编译过程,感触挺深的.在C语言中头文件其实起了一个很大的作用. 1. ...

随机推荐

  1. php判断浏览器还是微信打开

    本人亲测,但是存在一个小问题,就是用此方法在手机端打开会显示Google Chrome,但是在PC端是没有问题的,现在还在测试,先把第一版代码分享给大家! if(strpos($_SERVER['HT ...

  2. Angular组件——投影

    运行时动态改变组件模版的内容.没路由那么复杂,只是一段html,没有业务逻辑. ngContent指令将父组件模版上的任意片段投影到子组件上. 一.简单例子 1.子组件中使用<ng-conten ...

  3. 手动部署 kubernetes HA 集群

    前言 关于kubernetes HA集群部署的方式有很多种(这里的HA指的是master apiserver的高可用),比如通过keepalived vip漂移的方式.haproxy/nginx负载均 ...

  4. Python运算符——复合运算符

    就相当于算数运算符的后面加一个“=” 例:+= num = num+5   可以写成  num += 5 就是说,等式右边含有左边的变量名,就可以直接去掉,然后右边的符号移到左边去 同样的“-=  / ...

  5. Update修改方法判断该ID的数据是否超过24小时,超过不许修改

    @PostMapping("/update") public Result projectUpdate(@RequestBody ProjectVoEntity projectvo ...

  6. 安装SQL Server 2008时,安装程序配置检查RebootRequiredCheck时失败

    a .重启机器,再进行安装,如果发现还有该错误,请按下面步骤b.在开始->运行中输入regeditc.到HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\C ...

  7. TreeMap 的排序冲突吗

    今天在网上看到一个问题:一个已经构建好的 TreeSet,怎么完成倒排序? 网上给出的答案是: 通过TreeSet构造函数传入一个比较器,指定比较器进行排序为原排序的倒叙. TreeSet的自然排序是 ...

  8. asp.net core的DI框架思考以及服务实例的获取方式总结

    转载请注明出处: https://home.cnblogs.com/u/zhiyong-ITNote/ 整个asp.net core管道从WebHostBuilder到WebHost到后续请求的类中, ...

  9. jQuery中height()不能精确计算的问题

    jQuery中关于高度的计算有三个方法:outerHeight().innerHeight().height() outerHeight():获取元素集合中第一个元素的当前计算高度值,包括paddin ...

  10. 潭州课堂25班:Ph201805201 tornado 项目 第八课 增加喜欢功能(课堂笔记)

    tornado 相关说明 新增一个页面,用来做图片收藏, 还要在 account.py 创建一个数据库表,记录用户喜欢的图片,哪些图片用户疯狂传奇 cd 到 项目目录下,执行数据库更新 alembic ...