Please share the full build output, including a full exception. Also please share some information what branch you are trying to build.
That said, you should get a detailed error message regarding the java version, as building Elasticsearch (compared to runnig) usually requires one of the latest java versions.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.