We need to perform following steps to build hive source code.
1. Download hive source code.
2. Go to hive source directory and run 'ant clean'.
3. Remove the contents of ~/.ant/cache/hadoop/core/sources.
4. Copy the following files to ~/.ant/cache/hadoop/core/sources:
hadoop-0.17.2.1.tar.gz
hadoop-0.17.2.1.tar.gz.asc
hadoop-0.18.3.tar.gz
hadoop-0.18.3.tar.gz.asc
hadoop-0.19.0.tar.gz
hadoop-0.19.0.tar.gz.asc
hadoop-0.20.0.tar.gz
hadoop-0.20.0.tar.gz.asc
5. If you do not care about support for Hadoop 0.17.2.1, or 0.18, etc, you can disable support for these versions (and skip the download) by removing the references to these versions from shims/build.xml and shims/ivy.xml.
6. Again, go to hive source directory and run 'ant tar'.
7. Go to /src/build directory, where u will get hive-*.tar.gz.