BUILDING.txt 4.9 KB

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