Error in building and running Elasticsearch Source Code in IntelliJ IDEA

I want to import and run Elasticsearch source code into an IntelliJ IDEA project, for that :

  1. I have cloned the latest Elasticsearch Source Code from the official Github repository https://github.com/elastic/elasticsearch.
    JAVA_HOME is set to /home/bhavya/.jenv/versions/11

  2. Then I imported the project into IntelliJ IDEA

  3. Now when I run the elastic search from IntelliJ IDEA, using build.gradle, following response is generated

        4:41:23 PM: Executing task...

    > Task :buildSrc:reaper:compileJava
    > Task :buildSrc:reaper:processResources NO-SOURCE
    > Task :buildSrc:reaper:classes
    > Task :buildSrc:reaper:jar
    > Task :buildSrc:reaper:assemble
    > Task :buildSrc:reaper:compileTestJava NO-SOURCE
    > Task :buildSrc:reaper:processTestResources NO-SOURCE
    > Task :buildSrc:reaper:testClasses UP-TO-DATE
    > Task :buildSrc:reaper:test NO-SOURCE
    > Task :buildSrc:reaper:check UP-TO-DATE
    > Task :buildSrc:reaper:build

    > Task :buildSrc:compileJava
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.

    > Task :buildSrc:compileGroovy
    Note: /home/bhavya/Code/elasticsearch/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/TestWithSslPlugin.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/home/bhavya/.gradle/wrapper/dists/gradle-6.5-all/2oz4ud9k3tuxjg84bbf55q0tn/gradle-6.5/lib/groovy-all-1.3-2.5.11.jar) to method java.util.AbstractCollection.finishToArray(java.lang.Object[],java.util.Iterator)
    WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release

    > Task :buildSrc:generateVersionProperties UP-TO-DATE
    > Task :buildSrc:pluginDescriptors UP-TO-DATE
    > Task :buildSrc:processResources UP-TO-DATE
    > Task :buildSrc:classes
    > Task :buildSrc:jar
    > Task :buildSrc:assemble
    > Task :buildSrc:pluginUnderTestMetadata
    > Task :buildSrc:compileTestFixturesJava
    > Task :buildSrc:compileTestFixturesGroovy NO-SOURCE
    > Task :buildSrc:processTestFixturesResources NO-SOURCE
    > Task :buildSrc:testFixturesClasses
    > Task :buildSrc:testFixturesJar
    > Task :buildSrc:compileTestJava
    > Task :buildSrc:compileTestGroovy NO-SOURCE
    > Task :buildSrc:processTestResources UP-TO-DATE
    > Task :buildSrc:testClasses
    > Task :buildSrc:test SKIPPED
    > Task :buildSrc:validatePlugins
    > Task :buildSrc:check
    > Task :buildSrc:build
    =======================================
    Elasticsearch Build Hamster says Hello!
      Gradle Version        : 6.5
      OS Info               : Linux 5.3.0-62-generic (amd64)
      JDK Version           : 14 (OpenJDK)
      JAVA_HOME             : /usr/lib/jvm/jdk-14.0.1
      Random Testing Seed   : FABD41EAA6CF4507
      In FIPS 140 mode      : false
    =======================================

    > Task :help

    Welcome to Gradle 6.5.

    To run a build, run gradle <task> ...

    To see a list of available tasks, run gradle tasks

    To see a list of command-line options, run gradle --help

    To see more detail about a task, run gradle help --task <task>

    For troubleshooting, visit https://help.gradle.org

    BUILD SUCCESSFUL in 19s
    1 actionable task: 1 executed
    4:41:42 PM: Task execution finished.
  1. Now according to CONTRIBUTING.md, when I run Elasticsearch using command ./gradlew :run from the terminal, I get the following errors :

Error

        OpenJDK 64-Bit Server VM warning: Option AggressiveOpts was deprecated in version 11.0 and will likely be removed in a future release.
    OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
    =======================================
    Elasticsearch Build Hamster says Hello!
      Gradle Version        : 6.5
      OS Info               : Linux 5.3.0-62-generic (amd64)
      JDK Version           : 11 (JDK)
      JAVA_HOME             : /usr/lib/jvm/java-11-openjdk-amd64
      Random Testing Seed   : 2091C4A33F3190DA
      In FIPS 140 mode      : false
    =======================================

    > Task :x-pack:plugin:monitoring:compileJava FAILED
    /home/bhavya/Code/elasticsearch/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java:114: error: unexpected type
                            public void validate(final List<String> value) {
                                                       ^
      required: class
      found:    <any?>
    /home/bhavya/Code/elasticsearch/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java:114: error: unexpected type
                            public void validate(final List<String> value) {
                                                            ^
      required: reference
      found:    <any?>
    /home/bhavya/Code/elasticsearch/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java:119: error: unexpected type
                            public void validate(final List<String> hosts, final Map<Setting<?>, Object> settings) {
                                                       ^
      required: class
      found:    <any?>
    /home/bhavya/Code/elasticsearch/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java:119: error: unexpected type
                            public void validate(final List<String> hosts, final Map<Setting<?>, Object> settings) {
                                                            ^
      required: reference
      found:    <any?>
    /home/bhavya/Code/elasticsearch/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java:119: error: unexpected type
                            public void validate(final List<String> hosts, final Map<Setting<?>, Object> settings) {
                                                                                 ^
      required: class
      found:    <any?>
    /home/bhavya/Code/elasticsearch/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java:119: error: unexpected type
                            public void validate(final List<String> hosts, final Map<Setting<?>, Object> settings) {
                                                                                     ^
      required: class
      found:    <any?>
    /home/bhavya/Code/elasticsearch/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java:119: error: unexpected type
                            public void validate(final List<String> hosts, final Map<Setting<?>, Object> settings) {
                                                                                                 ^
      required: reference
      found:    <any?>
    /home/bhavya/Code/elasticsearch/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java:162: error: unexpected type
                            public Iterator<Setting<?>> settings() {
                                   ^
      required: class
      found:    <any?>
    /home/bhavya/Code/elasticsearch/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java:162: error: unexpected type
                            public Iterator<Setting<?>> settings() {
                                            ^
      required: class
      found:    <any?>
    9 errors

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':x-pack:plugin:monitoring:compileJava'.
    > java.lang.AssertionError: isSubtype UNKNOWN

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 7s
    353 actionable tasks: 4 executed, 349 up-to-date

Note: When JAVA_HOME is set to /home/bhavya/.jenv/versions/14, I get the following errors when trying to run Elasticsearch using ./gradlew :run

    Unrecognized VM option 'AggressiveOpts'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Can anyone help me in resolving this issue?

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