BUILDING.txt 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. Build instructions for Hadoop
  2. ----------------------------------------------------------------------------------
  3. Requirements:
  4. * Unix System
  5. * JDK 1.6
  6. * Maven 3.0
  7. * Forrest 0.8 (if generating docs)
  8. * Findbugs 1.3.9 (if running findbugs)
  9. * ProtocolBuffer 2.4.1+ (for MapReduce and HDFS)
  10. * CMake 2.6 or newer (if compiling native code)
  11. * Internet connection for first build (to fetch all Maven and Hadoop dependencies)
  12. ----------------------------------------------------------------------------------
  13. Maven main modules:
  14. hadoop (Main Hadoop project)
  15. - hadoop-project (Parent POM for all Hadoop Maven modules. )
  16. (All plugins & dependencies versions are defined here.)
  17. - hadoop-project-dist (Parent POM for modules that generate distributions.)
  18. - hadoop-annotations (Generates the Hadoop doclet used to generated the Javadocs)
  19. - hadoop-assemblies (Maven assemblies used by the different modules)
  20. - hadoop-common-project (Hadoop Common)
  21. - hadoop-hdfs-project (Hadoop HDFS)
  22. - hadoop-mapreduce-project (Hadoop MapReduce)
  23. - hadoop-tools (Hadoop tools like Streaming, Distcp, etc.)
  24. - hadoop-dist (Hadoop distribution assembler)
  25. ----------------------------------------------------------------------------------
  26. Where to run Maven from?
  27. It can be run from any module. The only catch is that if not run from utrunk
  28. all modules that are not part of the build run must be installed in the local
  29. Maven cache or available in a Maven repository.
  30. ----------------------------------------------------------------------------------
  31. Maven build goals:
  32. * Clean : mvn clean
  33. * Compile : mvn compile [-Pnative]
  34. * Run tests : mvn test [-Pnative]
  35. * Create JAR : mvn package
  36. * Run findbugs : mvn compile findbugs:findbugs
  37. * Run checkstyle : mvn compile checkstyle:checkstyle
  38. * Install JAR in M2 cache : mvn install
  39. * Deploy JAR to Maven repo : mvn deploy
  40. * Run clover : mvn test -Pclover [-DcloverLicenseLocation=${user.name}/.clover.license]
  41. * Run Rat : mvn apache-rat:check
  42. * Build javadocs : mvn javadoc:javadoc
  43. * Build distribution : mvn package [-Pdist][-Pdocs][-Psrc][-Pnative][-Dtar]
  44. * Change Hadoop version : mvn versions:set -DnewVersion=NEWVERSION
  45. Build options:
  46. * Use -Pnative to compile/bundle native code
  47. * Use -Pdocs to generate & bundle the documentation in the distribution (using -Pdist)
  48. * Use -Psrc to create a project source TAR.GZ
  49. * Use -Dtar to create a TAR with the distribution (using -Pdist)
  50. Snappy build options:
  51. Snappy is a compression library that can be utilized by the native code.
  52. It is currently an optional component, meaning that Hadoop can be built with
  53. or without this dependency.
  54. * Use -Drequire.snappy to fail the build if libsnappy.so is not found.
  55. If this option is not specified and the snappy library is missing,
  56. we silently build a version of libhadoop.so that cannot make use of snappy.
  57. This option is recommended if you plan on making use of snappy and want
  58. to get more repeatable builds.
  59. * Use -Dsnappy.prefix to specify a nonstandard location for the libsnappy
  60. header files and library files. You do not need this option if you have
  61. installed snappy using a package manager.
  62. * Use -Dsnappy.lib to specify a nonstandard location for the libsnappy library
  63. files. Similarly to snappy.prefix, you do not need this option if you have
  64. installed snappy using a package manager.
  65. * Use -Dbundle.snappy to copy the contents of the snappy.lib directory into
  66. the final tar file. This option requires that -Dsnappy.lib is also given,
  67. and it ignores the -Dsnappy.prefix option.
  68. Tests options:
  69. * Use -DskipTests to skip tests when running the following Maven goals:
  70. 'package', 'install', 'deploy' or 'verify'
  71. * -Dtest=<TESTCLASSNAME>,<TESTCLASSNAME#METHODNAME>,....
  72. * -Dtest.exclude=<TESTCLASSNAME>
  73. * -Dtest.exclude.pattern=**/<TESTCLASSNAME1>.java,**/<TESTCLASSNAME2>.java
  74. ----------------------------------------------------------------------------------
  75. Building distributions:
  76. Create binary distribution without native code and without documentation:
  77. $ mvn package -Pdist -DskipTests -Dtar
  78. Create binary distribution with native code and with documentation:
  79. $ mvn package -Pdist,native,docs -DskipTests -Dtar
  80. Create source distribution:
  81. $ mvn package -Psrc -DskipTests
  82. Create source and binary distributions with native code and documentation:
  83. $ mvn package -Pdist,native,docs,src -DskipTests -Dtar
  84. Create a local staging version of the website (in /tmp/hadoop-site)
  85. $ mvn clean site; mvn site:stage -DstagingDirectory=/tmp/hadoop-site
  86. ----------------------------------------------------------------------------------