pom.xml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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. </configuration>
  66. </plugin>
  67. </plugins>
  68. </build>
  69. <profiles>
  70. <profile>
  71. <id>dist</id>
  72. <activation>
  73. <activeByDefault>false</activeByDefault>
  74. <property>
  75. <name>tar</name>
  76. </property>
  77. </activation>
  78. <build>
  79. <plugins>
  80. <plugin>
  81. <groupId>org.apache.maven.plugins</groupId>
  82. <artifactId>maven-antrun-plugin</artifactId>
  83. <executions>
  84. <execution>
  85. <id>dist</id>
  86. <phase>prepare-package</phase>
  87. <goals>
  88. <goal>run</goal>
  89. </goals>
  90. <configuration>
  91. <target>
  92. <echo file="${project.build.directory}/dist-layout-stitching.sh">
  93. run() {
  94. echo "\$ ${@}"
  95. "${@}"
  96. res=$?
  97. if [ $res != 0 ]; then
  98. echo
  99. echo "Failed!"
  100. echo
  101. exit $res
  102. fi
  103. }
  104. findFileInDir(){
  105. local file="$1";
  106. local dir="${2:-./share}";
  107. local count=$(find "$dir" -iname "$file"|wc -l)
  108. echo "$count";
  109. }
  110. copyIfNotExists(){
  111. local src="$1"
  112. local srcName=$(basename "$src")
  113. local dest="$2";
  114. if [ -f "$src" ]; then
  115. if [[ "$srcName" != *.jar ]] || [ $(findFileInDir "$srcName") -eq "0" ]; then
  116. local destDir=$(dirname "$dest")
  117. mkdir -p "$destDir"
  118. cp "$src" "$dest"
  119. fi
  120. else
  121. for childPath in "$src"/* ;
  122. do
  123. child=$(basename "$childPath");
  124. if [ "$child" == "doc" ] || [ "$child" == "webapps" ]; then
  125. mkdir -p "$dest"/"$child"
  126. cp -r "$src"/"$child"/* "$dest"/"$child"
  127. continue;
  128. fi
  129. copyIfNotExists "$src"/"$child" "$dest"/"$child"
  130. done
  131. fi
  132. }
  133. #Copy all contents as is except the lib.
  134. #for libs check for existence in share directory, if not exist then only copy.
  135. copy(){
  136. local src="$1";
  137. local dest="$2";
  138. if [ -d "$src" ]; then
  139. for childPath in "$src"/* ;
  140. do
  141. child=$(basename "$childPath");
  142. if [ "$child" == "share" ]; then
  143. copyIfNotExists "$src"/"$child" "$dest"/"$child"
  144. else
  145. if [ -d "$src"/"$child" ]; then
  146. mkdir -p "$dest"/"$child"
  147. cp -r "$src"/"$child"/* "$dest"/"$child"
  148. else
  149. cp -r "$src"/"$child" "$dest"/"$child"
  150. fi
  151. fi
  152. done
  153. fi
  154. }
  155. # Shellcheck SC2086
  156. ROOT=$(cd "${project.build.directory}"/../..;pwd)
  157. echo
  158. echo "Current directory $(pwd)"
  159. echo
  160. run rm -rf hadoop-${project.version}
  161. run mkdir hadoop-${project.version}
  162. run cd hadoop-${project.version}
  163. run cp "$ROOT"/LICENSE.txt .
  164. run cp "$ROOT"/NOTICE.txt .
  165. run cp "$ROOT"/README.txt .
  166. # Copy hadoop-common first so that it have always have all dependencies.
  167. # Remaining projects will copy only libraries which are not present already in 'share' directory.
  168. run copy "$ROOT"/hadoop-common-project/hadoop-common/target/hadoop-common-${project.version} .
  169. run copy "$ROOT"/hadoop-common-project/hadoop-nfs/target/hadoop-nfs-${project.version} .
  170. run copy "$ROOT"/hadoop-hdfs-project/hadoop-hdfs/target/hadoop-hdfs-${project.version} .
  171. run copy "$ROOT"/hadoop-hdfs-project/hadoop-hdfs-nfs/target/hadoop-hdfs-nfs-${project.version} .
  172. run copy "$ROOT"/hadoop-yarn-project/target/hadoop-yarn-project-${project.version} .
  173. run copy "$ROOT"/hadoop-mapreduce-project/target/hadoop-mapreduce-${project.version} .
  174. run copy "$ROOT"/hadoop-tools/hadoop-tools-dist/target/hadoop-tools-dist-${project.version} .
  175. #copy httpfs and kms as is
  176. run cp -r "$ROOT"/hadoop-hdfs-project/hadoop-hdfs-httpfs/target/hadoop-hdfs-httpfs-${project.version}/* .
  177. run cp -r "$ROOT"/hadoop-common-project/hadoop-kms/target/hadoop-kms-${project.version}/* .
  178. echo
  179. echo "Hadoop dist layout available at: ${project.build.directory}/hadoop-${project.version}"
  180. echo
  181. </echo>
  182. <exec executable="sh" dir="${project.build.directory}" failonerror="true">
  183. <arg line="./dist-layout-stitching.sh"/>
  184. </exec>
  185. </target>
  186. </configuration>
  187. </execution>
  188. <execution>
  189. <id>tar</id>
  190. <phase>package</phase>
  191. <goals>
  192. <goal>run</goal>
  193. </goals>
  194. <configuration>
  195. <target if="tar">
  196. <echo file="${project.build.directory}/dist-tar-stitching.sh">
  197. run() {
  198. echo "\$ ${@}"
  199. "${@}"
  200. res=$?
  201. if [ $res != 0 ]; then
  202. echo
  203. echo "Failed!"
  204. echo
  205. exit $res
  206. fi
  207. }
  208. run tar cf hadoop-${project.version}.tar hadoop-${project.version}
  209. run gzip -f hadoop-${project.version}.tar
  210. echo
  211. echo "Hadoop dist tar available at: ${project.build.directory}/hadoop-${project.version}.tar.gz"
  212. echo
  213. </echo>
  214. <exec executable="sh" dir="${project.build.directory}" failonerror="true">
  215. <arg line="./dist-tar-stitching.sh"/>
  216. </exec>
  217. </target>
  218. </configuration>
  219. </execution>
  220. </executions>
  221. </plugin>
  222. </plugins>
  223. </build>
  224. </profile>
  225. </profiles>
  226. </project>