# Building v2.3.5 from source fails

**URL:** https://discuss.elastic.co/t/building-v2-3-5-from-source-fails/62069
**Category:** Elasticsearch
**Created:** [October 3, 2016, 1:11pm UTC](https://discuss.elastic.co/t/building-v2-3-5-from-source-fails/62069 "2016-10-03T13:11:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![lukas\_vlcek](https://avatars.discourse-cdn.com/v4/letter/l/dfb087/32.png) [@lukas\_vlcek](https://discuss.elastic.co/u/lukas_vlcek)
#### Post date: [October 3, 2016, 1:11pm UTC](https://discuss.elastic.co/t/building-v2-3-5-from-source-fails/62069/1 "2016-10-03T13:11:26Z")

</div>

Hi,

I am trying to build Elasticsearch **v2.3.5** from sources but I am running into build error:

The flow is pretty simple:

```auto
$ git clone https://github.com/elastic/elasticsearch.git
$ cd elasticsearch
$ git checkout v2.3.5
$ mvn clean package
// doing $ mvn clean package -DskipTests fails as well

```

Complete log can be seen here: [https://gist.github.com/lukas-vlcek/fa9b33ec54e6d4c7a38a74f97a4b9601](https://gist.github.com/lukas-vlcek/fa9b33ec54e6d4c7a38a74f97a4b9601)

Excerpt:

```auto
...
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ elasticsearch ---
[INFO] Compiling 2977 source files to /Users/lvlcek/projects/tmp/elasticsearch/core/target/classes
[WARNING] Unable to autodetect 'javac' path, using 'javac' from the environment.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Build Tools and Resources .......................... SUCCESS [0.804 s]
[INFO] Rest API Specification ............................. SUCCESS [0.418 s]
[INFO] Elasticsearch: Parent POM .......................... SUCCESS [6.334 s]
[INFO] Elasticsearch: Core ................................ FAILURE [3.591 s]
[INFO] Distribution: Parent POM ........................... SKIPPED
[INFO] Integration Test Package: ZIP ...................... SKIPPED
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.904 s
[INFO] Finished at: 2016-10-03T14:53:31+02:00
[INFO] Final Memory: 66M/1241M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project elasticsearch: Compilation failure -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :elasticsearch
...

```

One interesting thing is that from ES 2.x it seems the tag commits point to `-SNAPSHOT` versions. See: [https://github.com/elastic/elasticsearch/blob/v2.3.5/pom.xml#L9](https://github.com/elastic/elasticsearch/blob/v2.3.5/pom.xml#L9) or [https://github.com/elastic/elasticsearch/blob/90f439ff60a3c0f497f91663701e64ccd01edbb4/pom.xml#L9](https://github.com/elastic/elasticsearch/blob/90f439ff60a3c0f497f91663701e64ccd01edbb4/pom.xml#L9)

Why is that? Shall I modify pom.xml files and remove `-SNAPSHOT` manually before building final version?

May be I am reading something wrong in  
[https://github.com/elastic/elasticsearch/tree/v2.3.5#building-from-source](https://github.com/elastic/elasticsearch/tree/v2.3.5#building-from-source) or [https://github.com/elastic/elasticsearch/blob/v2.3.5/TESTING.asciidoc](https://github.com/elastic/elasticsearch/blob/v2.3.5/TESTING.asciidoc)?

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [October 4, 2016, 7:57am UTC](https://discuss.elastic.co/t/building-v2-3-5-from-source-fails/62069/2 "2016-10-04T07:57:39Z")

</div>

Here it works (well, somehow, but the build fails to sign the Debian package, a failure which I expect)

> <https://gist.github.com/jprante/35041580b6d4a31d2041df54812e1461>

Seems your Maven does not detect a JDK so it emits the message

```auto
[WARNING] Unable to autodetect 'javac' path, using 'javac' from the environment.

```

Maybe setting `JAVA_HOME` helps?

env | grep JAVA  
JAVA\_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0\_102.jdk/Contents/Home

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [October 4, 2016, 7:59am UTC](https://discuss.elastic.co/t/building-v2-3-5-from-source-fails/62069/3 "2016-10-04T07:59:22Z")

</div>

> [@lukas\_vlcek](#):
>
> One interesting thing is that from ES 2.x it seems the tag commits point to -SNAPSHOT versions.

Yes, that's nasty. I reset the version manually by editing pom.xml.

---

<div class="post-metadata">

### Author: ![lukas\_vlcek](https://avatars.discourse-cdn.com/v4/letter/l/dfb087/32.png) [@lukas\_vlcek](https://discuss.elastic.co/u/lukas_vlcek)
#### Post date: [October 4, 2016, 10:59am UTC](https://discuss.elastic.co/t/building-v2-3-5-from-source-fails/62069/4 "2016-10-04T10:59:27Z")

</div>

@jprante good catch, thanks! After I changed from

JAVA\_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0\_65.jdk/Contents/Home/jre  
to  
JAVA\_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0\_65.jdk/Contents/Home

the `mvn clean package -DskipTests` passed without any issues (not even running into issues with Deb package building, interesting you are running into it...).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 10:15pm UTC](https://discuss.elastic.co/t/building-v2-3-5-from-source-fails/62069/5 "2017-07-05T22:15:12Z")

</div>


