Running Elasticsearch locally in cloned repository [Ubuntu]

I recently started working on fixing a bug mentioned in the Elasticsearch GitHub repository issues. After installing Elasticsearch and reproducing the bug with the downloaded version from the website, I had an idea of how to solve it. However, I'm facing difficulties running the project locally after cloning it from GitHub.

I began by cloning the repository to my workspace and then attempted to run the command ./gradlew run in the main directory of the project. Although it took a considerable amount of time for the project to execute, it ultimately failed near the end, preventing me from running Elasticsearch from the repository.

As a newcomer to Elasticsearch, I believe I might not be approaching this in the most efficient manner and could be making some rookie mistakes. I would greatly appreciate any assistance or guidance on this matter, whether it's direct help or pointers to useful tutorials.

I think the best source is probably elasticsearch/CONTRIBUTING.md at main · elastic/elasticsearch · GitHub and elasticsearch/TESTING.asciidoc at main · elastic/elasticsearch · GitHub

1 Like

while, following the simple steps mentioned in the elasticsearch/CONTRIBUTING.md I still couldn't compile the code for some reason i keep getting this error...

Task :libs:elasticsearch-native:elasticsearch-native-libraries:extractLibs FAILED

FAILURE: Build failed with an exception.

After running with --stacktrace i got a few exceptions like this:

Cause 2: java.io.UncheckedIOException: Could not read workspace metadata from /home/renatolo/.gradle/caches/transforms-4/ab69dbefb0b3497d91e1341374e3735c/metadata.bin

Not sure if Im lacking any software installed or so, but this exceptions are very weird and I am not seeing any way of going arround them

I think we'd need to see more detail on the exception you're experiencing, these few messages aren't really enough to help. That said, it could be that you're seeing something that has since been fixed, so make sure you're on the latest checkout from main and maybe try a ./gradlew clean and ./gradlew --stop too.

Also we don't often use ./gradlew run during development, it's a very slow way to get feedback on any changes you're making. Instead it's more normal to write a test case (or cases) that reproduce(s) the bug and then just run this (or these) tests.

1 Like