pom.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <parent>
  6. <artifactId>recommend-feature</artifactId>
  7. <groupId>com.tzld.piaoquan</groupId>
  8. <version>1.0.0</version>
  9. </parent>
  10. <modelVersion>4.0.0</modelVersion>
  11. <artifactId>recommend-feature-produce</artifactId>
  12. <properties>
  13. <!-- <spark.version>3.3.1</spark.version>-->
  14. <!-- <scala.version>2.12.15</scala.version>-->
  15. <spark.version>2.3.0</spark.version>
  16. <scala.version>2.11.8</scala.version>
  17. <emr.version>2.0.0</emr.version>
  18. <java.version>1.8</java.version>
  19. <odps.version>0.48.4-public</odps.version>
  20. <fastjson.version>1.2.45</fastjson.version>
  21. <maven.compiler.source>8</maven.compiler.source>
  22. <maven.compiler.target>8</maven.compiler.target>
  23. </properties>
  24. <dependencies>
  25. <dependency>
  26. <groupId>org.apache.spark</groupId>
  27. <artifactId>spark-core_2.11</artifactId>
  28. <version>${spark.version}</version>
  29. <exclusions>
  30. <exclusion>
  31. <groupId>io.netty</groupId>
  32. <artifactId>netty-all</artifactId>
  33. </exclusion>
  34. <exclusion>
  35. <artifactId>slf4j-log4j12</artifactId>
  36. <groupId>org.slf4j</groupId>
  37. </exclusion>
  38. </exclusions>
  39. </dependency>
  40. <dependency>
  41. <groupId>io.netty</groupId>
  42. <artifactId>netty-all</artifactId>
  43. <version>4.1.17.Final</version>
  44. </dependency>
  45. <dependency>
  46. <groupId>com.aliyun.emr</groupId>
  47. <artifactId>emr-maxcompute_2.11</artifactId>
  48. <version>${emr.version}</version>
  49. </dependency>
  50. <dependency>
  51. <groupId>org.scala-lang</groupId>
  52. <artifactId>scala-library</artifactId>
  53. <version>${scala.version}</version>
  54. </dependency>
  55. <dependency>
  56. <groupId>com.alibaba</groupId>
  57. <artifactId>fastjson</artifactId>
  58. <version>${fastjson.version}</version>
  59. </dependency>
  60. <dependency>
  61. <groupId>redis.clients</groupId>
  62. <artifactId>jedis</artifactId>
  63. <version>5.1.3</version>
  64. </dependency>
  65. <dependency>
  66. <groupId>com.aliyun.odps</groupId>
  67. <artifactId>odps-sdk-core</artifactId>
  68. <version>${odps.version}</version>
  69. <exclusions>
  70. <exclusion>
  71. <groupId>org.codehaus.jackson</groupId>
  72. <artifactId>jackson-mapper-asl</artifactId>
  73. </exclusion>
  74. <exclusion>
  75. <groupId>org.codehaus.jackson</groupId>
  76. <artifactId>jackson-core-asl</artifactId>
  77. </exclusion>
  78. </exclusions>
  79. </dependency>
  80. <dependency>
  81. <groupId>com.aliyun.odps</groupId>
  82. <artifactId>odps-sdk-commons</artifactId>
  83. <version>${odps.version}</version>
  84. </dependency>
  85. <dependency>
  86. <groupId>org.projectlombok</groupId>
  87. <artifactId>lombok</artifactId>
  88. <version>1.18.24</version>
  89. </dependency>
  90. <dependency>
  91. <groupId>com.ctrip.framework.apollo</groupId>
  92. <artifactId>apollo-client</artifactId>
  93. <version>1.8.0</version>
  94. </dependency>
  95. <dependency>
  96. <groupId>org.slf4j</groupId>
  97. <artifactId>slf4j-simple</artifactId>
  98. <version>1.7.28</version>
  99. </dependency>
  100. <dependency>
  101. <groupId>com.aliyun.oss</groupId>
  102. <artifactId>aliyun-sdk-oss</artifactId>
  103. <version>3.17.4</version>
  104. </dependency>
  105. <!-- Snappy compression library -->
  106. <dependency>import org.xerial.snappy.Snappy;
  107. import java.io.ByteArrayInputStream;
  108. import java.io.ByteArrayOutputStream;
  109. import java.io.IOException;
  110. import java.util.zip.GZIPInputStream;
  111. import java.util.zip.GZIPOutputStream;
  112. import java.util.zip.ZipEntry;
  113. import java.util.zip.ZipInputStream;
  114. import java.util.zip.ZipOutputStream;
  115. public class CompressionUtil {
  116. // ZIP压缩
  117. public static byte[] zipCompress(byte[] data) throws IOException {
  118. ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
  119. ZipOutputStream zipOutputStream = new ZipOutputStream(byteArrayOutputStream);
  120. ZipEntry zipEntry = new ZipEntry("data");
  121. zipOutputStream.putNextEntry(zipEntry);
  122. zipOutputStream.write(data);
  123. zipOutputStream.closeEntry();
  124. zipOutputStream.close();
  125. return byteArrayOutputStream.toByteArray();
  126. }
  127. // ZIP解压缩
  128. public static byte[] zipDecompress(byte[] compressedData) throws IOException {
  129. ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(compressedData);
  130. ZipInputStream zipInputStream = new ZipInputStream(byteArrayInputStream);
  131. ZipEntry zipEntry = zipInputStream.getNextEntry();
  132. ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
  133. byte[] buffer = new byte[1024];
  134. int len;
  135. while ((len = zipInputStream.read(buffer)) != -1) {
  136. byteArrayOutputStream.write(buffer, 0, len);
  137. }
  138. zipInputStream.closeEntry();
  139. zipInputStream.close();
  140. return byteArrayOutputStream.toByteArray();
  141. }
  142. // ZLIB压缩(使用Java的ZipOutputStream进行模拟)
  143. public static byte[] zlibCompress(byte[] data) throws IOException {
  144. ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
  145. ZipOutputStream zipOutputStream = new ZipOutputStream(byteArrayOutputStream);
  146. ZipEntry zipEntry = new ZipEntry("data");
  147. zipOutputStream.putNextEntry(zipEntry);
  148. zipOutputStream.write(data);
  149. zipOutputStream.closeEntry();
  150. zipOutputStream.close();
  151. return byteArrayOutputStream.toByteArray();
  152. }
  153. // ZLIB解压缩(使用Java的ZipInputStream进行模拟)
  154. public static byte[] zlibDecompress(byte[] compressedData) throws IOException {
  155. ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(compressedData);
  156. ZipInputStream zipInputStream = new ZipInputStream(byteArrayInputStream);
  157. ZipEntry zipEntry = zipInputStream.getNextEntry();
  158. ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
  159. byte[] buffer = new byte[1024];
  160. int len;
  161. while ((len = zipInputStream.read(buffer)) != -1) {
  162. byteArrayOutputStream.write(buffer, 0, len);
  163. }
  164. zipInputStream.closeEntry();
  165. zipInputStream.close();
  166. return byteArrayOutputStream.toByteArray();
  167. }
  168. // Snappy压缩
  169. public static byte[] snappyCompress(byte[] data) {
  170. return Snappy.compress(data);
  171. }
  172. // Snappy解压缩
  173. public static byte[] snappyDecompress(byte[] compressedData) {
  174. return Snappy.uncompress(compressedData);
  175. }
  176. }
  177. <groupId>org.xerial.snappy</groupId>
  178. <artifactId>snappy-java</artifactId>
  179. <version>1.1.8.4</version>
  180. </dependency>
  181. </dependencies>
  182. <build>
  183. <plugins>
  184. <plugin>
  185. <groupId>org.apache.maven.plugins</groupId>
  186. <artifactId>maven-assembly-plugin</artifactId>
  187. <version>2.5.5</version>
  188. <configuration>
  189. <descriptorRefs>
  190. <descriptorRef>jar-with-dependencies</descriptorRef>
  191. </descriptorRefs>
  192. <finalName>${project.name}</finalName>
  193. </configuration>
  194. <executions>
  195. <execution>
  196. <id>make-assembly</id>
  197. <phase>package</phase>
  198. <goals>
  199. <goal>single</goal>
  200. </goals>
  201. </execution>
  202. </executions>
  203. </plugin>
  204. </plugins>
  205. </build>
  206. </project>