Issue in building elasticsearch 7 from source

Hi,
I am building Elasticsearch 7.0.1 from source using gradle. I have installed jdk-11 for the same. But I am facing the below issue.
05:42:13.524 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > the compiler java.home must be set to a JDK installation directory for Java 12 but is [/etc/alternatives/java_sdk_11_openjdk] corresponding to [11]
So is it mandatory to use jdk-12 or higher version for building Elasticsearch?

JDK13 is required to build Elasticsearch.

Correction: I linked to the master docs but I just saw you are trying to build an older version. JDK12 is required to build Elasticsearch 7.0.1.

Okay. Thank you for the response.
I am using Gradle- "5.2.1", jdk- "12.0.2".
I am getting the below error while building elasticsearch 7.0.1

Task :x-pack:plugin:ml:cpp-snapshot:downloadMachineLearningSnapshot FAILED
FAILURE: Build failed with an exception.

* Where:
Build file '/home/cloud-user/chaitra/elasticsearch-7.0.1/x-pack/plugin/ml/cpp-snapshot/build.gradle' line: 17

* What went wrong:
Execution failed for task ':x-pack:plugin:ml:cpp-snapshot:downloadMachineLearningSnapshot'.
java.net.ConnectException: Connection timed out (Connection timed out)

I want to build only Elasticsearch-OSS. So is there any CLI command that can be passed with gradle assemble so that i can build only OSS?

Hmm, it looks like your build machine doesn't have internet access. I think internet access is required even for an OSS-only build.

Hi,
I have proxy configured on the system. With this proxy I am able to reach internet also.
So the same proxy I am using in gradle assemble command.
When I was not using the proxy with gradle command, it was failing to reach jcenter.com. But after using the same proxy with gradle assemble command it went further and started failing and the exception was Connection timed out(as mentioned in previous comment of the post).
I am using below command for gradle build.
gradle assemble -Dorg.gradle.java.home=/path/to/jdk-12.0.2 -Dhttps.proxyHost=xxx.xx.xx.xx -Dhttps.proxyPort=yy

I am able to reach internet.(After exporting the same proxy as in gradle assemble)
-bash-4.2$ wget https://google.com
--2020-03-03 06:37:20-- https://google.com/
Connecting to 135.245.48.34:8000... connected.
Proxy request sent, awaiting response... 301 Moved Permanently
Location: https://www.google.com/ [following]
--2020-03-03 06:37:20-- https://www.google.com/
Connecting to xxx.xx.xx:yy... connected.
Proxy request sent, awaiting response... 200 OK
So is there anything I am missing out while building?
And how can I disable building x-pack?

I could believe that your proxy is causing this issue, but unfortunately I don't know how to resolve it. This part of the build system is really quite different in maintained versions, and looks better integrated with Gradle now so maybe this is fixed. Can you try building a maintained version instead?

By running assemble from the root of the project you will build all distributions. You should find the specific distribution project you want to build and run assemble there. The oss ones have oss in the project name.

1 Like

Hi,
I have taken the src code of elasticsearch from https://github.com/elastic/elasticsearch/archive/v7.0.1.zip.
I tried building the oss-rpm by commenting out the x-pack related gradle files and wherever it failed for x-pack related settings. Finally I am able to build the oss rpm.
I installed the oss-rpm and evrything is working fine. But I see in curl to elasticsearch for build_hash: "Unknown". Below is the output.

-bash-4.2# curl xxx.xx.xx.xx:9200
    {
      "name" : "node1",
      "cluster_name" : "elasticsearch",
      "cluster_uuid" : "h5dbPsIDQESwzINzj8eq-Q",
      "version" : {
        "number" : "7.0.1",
        "build_flavor" : "oss",
        "build_type" : "rpm",
        "build_hash" : "Unknown",
        "build_date" : "2020-03-04T11:51:06.297438Z",
        "build_snapshot" : false,
        "lucene_version" : "8.0.0",
        "minimum_wire_compatibility_version" : "6.7.0",
        "minimum_index_compatibility_version" : "6.0.0-beta1"
      },
      "tagline" : "You Know, for Search"
    }

Why it is taking build_hash as Unknown? I am missing something here?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.