pom.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License. See accompanying LICENSE file.
  12. -->
  13. <project xmlns="http://maven.apache.org/POM/4.0.0"
  14. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  15. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
  16. http://maven.apache.org/xsd/maven-4.0.0.xsd">
  17. <modelVersion>4.0.0</modelVersion>
  18. <parent>
  19. <groupId>org.apache.hadoop</groupId>
  20. <artifactId>hadoop-project</artifactId>
  21. <version>3.0.0-SNAPSHOT</version>
  22. <relativePath>../hadoop-project</relativePath>
  23. </parent>
  24. <groupId>org.apache.hadoop</groupId>
  25. <artifactId>hadoop-dist</artifactId>
  26. <version>3.0.0-SNAPSHOT</version>
  27. <description>Apache Hadoop Distribution</description>
  28. <name>Apache Hadoop Distribution</name>
  29. <packaging>jar</packaging>
  30. <!-- Using dependencies to ensure this module is the last one -->
  31. <dependencies>
  32. <dependency>
  33. <groupId>org.apache.hadoop</groupId>
  34. <artifactId>hadoop-common</artifactId>
  35. <scope>provided</scope>
  36. </dependency>
  37. <dependency>
  38. <groupId>org.apache.hadoop</groupId>
  39. <artifactId>hadoop-hdfs</artifactId>
  40. <scope>provided</scope>
  41. </dependency>
  42. <dependency>
  43. <groupId>org.apache.hadoop</groupId>
  44. <artifactId>hadoop-mapreduce-client-app</artifactId>
  45. <scope>provided</scope>
  46. </dependency>
  47. <dependency>
  48. <groupId>org.apache.hadoop</groupId>
  49. <artifactId>hadoop-yarn-api</artifactId>
  50. <scope>provided</scope>
  51. </dependency>
  52. </dependencies>
  53. <build>
  54. <plugins>
  55. <plugin>
  56. <artifactId>maven-deploy-plugin</artifactId>
  57. <configuration>
  58. <skip>true</skip>
  59. </configuration>
  60. </plugin>
  61. <plugin>
  62. <groupId>org.apache.rat</groupId>
  63. <artifactId>apache-rat-plugin</artifactId>
  64. <configuration>
  65. <includes>
  66. <include>pom.xml</include>
  67. </includes>
  68. </configuration>
  69. </plugin>
  70. </plugins>
  71. </build>
  72. <profiles>
  73. <profile>
  74. <id>dist</id>
  75. <activation>
  76. <activeByDefault>false</activeByDefault>
  77. <property>
  78. <name>tar|rpm|deb</name>
  79. </property>
  80. </activation>
  81. <build>
  82. <plugins>
  83. <plugin>
  84. <groupId>org.apache.maven.plugins</groupId>
  85. <artifactId>maven-antrun-plugin</artifactId>
  86. <executions>
  87. <execution>
  88. <id>tar</id>
  89. <phase>package</phase>
  90. <goals>
  91. <goal>run</goal>
  92. </goals>
  93. <configuration>
  94. <target if="tar">
  95. <!-- This script preserves permissions and symlinks. -->
  96. <!-- Python requires resetting indentation to far left. -->
  97. <echo file="${project.build.directory}/dist-maketar.py">
  98. from os.path import abspath, basename, isdir, join
  99. import tarfile
  100. def make_file_filter(root, file_name_filter):
  101. def filter_func(tar_info):
  102. if tar_info.name == root:
  103. # Always include root directory. Otherwise, tarfile.add assumes you are
  104. # filtering out the whole directory and produces an empty tar.
  105. return tar_info
  106. if tar_info.isfile() or tar_info.issym():
  107. # Include files and symlinks only if they match the specified name filter.
  108. if file_name_filter(basename(tar_info.name)):
  109. return tar_info
  110. # Otherwise, exclude.
  111. return None
  112. return filter_func
  113. target_dirs = [
  114. abspath(r"${basedir}/../hadoop-common-project/hadoop-common/target/hadoop-common-${project.version}"),
  115. abspath(r"${basedir}/../hadoop-hdfs-project/hadoop-hdfs/target/hadoop-hdfs-${project.version}"),
  116. abspath(r"${basedir}/../hadoop-hdfs-project/hadoop-hdfs-httpfs/target/hadoop-hdfs-httpfs-${project.version}"),
  117. abspath(r"${basedir}/../hadoop-yarn-project/target/hadoop-yarn-project-${project.version}"),
  118. abspath(r"${basedir}/../hadoop-mapreduce-project/target/hadoop-mapreduce-${project.version}"),
  119. abspath(r"${basedir}/../hadoop-tools/hadoop-tools-dist/target/hadoop-tools-dist-${project.version}")
  120. ]
  121. base_name = "hadoop" + "-" + "${project.version}"
  122. dir_name = abspath(join(r"${project.build.directory}", base_name))
  123. tar_name = dir_name + ".tar.gz"
  124. with tarfile.open(tar_name, "w:gz") as tar:
  125. for target_dir in target_dirs:
  126. tar.add(target_dir, arcname=base_name)
  127. native_dir = abspath(join(target_dir, "../native/target/usr/local/lib"))
  128. if isdir(native_dir):
  129. arc_name = base_name + "/lib/native"
  130. tar.add(native_dir, arcname=arc_name,
  131. filter=make_file_filter(arc_name, lambda file: file.startswith("lib")))
  132. bin_dir = abspath(join(target_dir, "../bin"))
  133. if isdir(bin_dir):
  134. arc_name = base_name + "/bin"
  135. tar.add(bin_dir, arcname=arc_name)
  136. if "${bundle.snappy}" == "true":
  137. arc_name = base_name + "/lib/native"
  138. tar.add(r"${snappy.lib}", arcname=arc_name,
  139. filter=make_file_filter(arc_name, lambda file: "snappy" in file))
  140. print
  141. print "Hadoop dist tar available at: " + tar_name
  142. print
  143. </echo>
  144. <exec executable="python" dir="${project.build.directory}" failonerror="true">
  145. <arg value="dist-maketar.py" />
  146. </exec>
  147. </target>
  148. </configuration>
  149. </execution>
  150. </executions>
  151. </plugin>
  152. </plugins>
  153. </build>
  154. </profile>
  155. </profiles>
  156. </project>