BUILDING.txt 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. * Autotools (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 -Dsnappy.prefix=(/usr/local) & -Dbundle.snappy=(false) to compile
  48. Snappy JNI bindings and to bundle Snappy SO files
  49. * Use -Pdocs to generate & bundle the documentation in the distribution (using -Pdist)
  50. * Use -Psrc to create a project source TAR.GZ
  51. * Use -Dtar to create a TAR with the distribution (using -Pdist)
  52. Tests options:
  53. * Use -DskipTests to skip tests when running the following Maven goals:
  54. 'package', 'install', 'deploy' or 'verify'
  55. * -Dtest=<TESTCLASSNAME>,<TESTCLASSNAME#METHODNAME>,....
  56. * -Dtest.exclude=<TESTCLASSNAME>
  57. * -Dtest.exclude.pattern=**/<TESTCLASSNAME1>.java,**/<TESTCLASSNAME2>.java
  58. ----------------------------------------------------------------------------------
  59. Building distributions:
  60. Create binary distribution without native code and without documentation:
  61. $ mvn package -Pdist -DskipTests -Dtar
  62. Create binary distribution with native code and with documentation:
  63. $ mvn package -Pdist,native,docs -DskipTests -Dtar
  64. Create source distribution:
  65. $ mvn package -Psrc -DskipTests
  66. Create source and binary distributions with native code and documentation:
  67. $ mvn package -Pdist,native,docs,src -DskipTests -Dtar
  68. Create a local staging version of the website (in /tmp/hadoop-site)
  69. $ mvn clean site; mvn site:stage -DstagingDirectory=/tmp/hadoop-site
  70. ----------------------------------------------------------------------------------