Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.27 KB | None | 0 0
  1. pom.xml
  2. src/main/scala/com/test/spark/mycode.scala
  3. src/test/scala/com/test/spark/test.scala
  4.  
  5. [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ mycode ---
  6. [INFO] Nothing to compile - all classes are up to date
  7.  
  8. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  9. <modelVersion>4.0.0</modelVersion>
  10. <groupId>com.test.spark</groupId>
  11. <artifactId>mycode</artifactId>
  12. <version>0.0.1</version>
  13. <name>${project.artifactId}</name>
  14. <description>Simple wtest</description>
  15. <inceptionYear>2017</inceptionYear>
  16.  
  17. <!-- change from 1.6 to 1.7 depending on Java version -->
  18. <properties>
  19. <maven.compiler.source>1.6</maven.compiler.source>
  20. <maven.compiler.target>1.6</maven.compiler.target>
  21. <encoding>UTF-8</encoding>
  22. <scala.version>2.11.5</scala.version>
  23. <scala.compat.version>2.11</scala.compat.version>
  24. <spark.version>1.6.1</spark.version>
  25. </properties>
  26.  
  27. <dependencies>
  28. <dependency>
  29. <groupId>org.scala-lang</groupId>
  30. <artifactId>scala-library</artifactId>
  31. <version>${scala.version}</version>
  32. </dependency>
  33.  
  34. <!-- Spark dependency -->
  35. <dependency>
  36. <groupId>org.apache.spark</groupId>
  37. <artifactId>spark-core_${scala.compat.version}</artifactId>
  38. <version>${spark.version}</version>
  39. </dependency>
  40. <!-- Spark sql dependency -->
  41. <dependency>
  42. <groupId>org.apache.spark</groupId>
  43. <artifactId>spark-sql_${scala.compat.version}</artifactId>
  44. <version>${spark.version}</version>
  45. </dependency>
  46. <!-- Spark hive dependency -->
  47. <dependency>
  48. <groupId>org.apache.spark</groupId>
  49. <artifactId>spark-hive_${scala.compat.version}</artifactId>
  50. <version>${spark.version}</version>
  51. </dependency>
  52. <!-- spark-testing-base dependency -->
  53. <dependency>
  54. <groupId>com.holdenkarau</groupId>
  55. <artifactId>spark-testing-base_2.11</artifactId>
  56. <version>${spark.version}_0.6.0</version>
  57. <scope>test</scope>
  58. </dependency>
  59. <dependency>
  60. <groupId>org.scalactic</groupId>
  61. <artifactId>scalactic_2.11</artifactId>
  62. <version>3.0.1</version>
  63. </dependency>
  64. <dependency>
  65. <groupId>org.scalatest</groupId>
  66. <artifactId>scalatest_2.11</artifactId>
  67. <version>3.2.0-SNAP5</version>
  68. <scope>test</scope>
  69. </dependency>
  70. </dependencies>
  71.  
  72. <build>
  73. <sourceDirectory>src/main/scala</sourceDirectory>
  74. <testSourceDirectory>src/test/scala</testSourceDirectory>
  75. <!-- Create JAR with all dependencies -->
  76. <plugins>
  77. <plugin>
  78. <artifactId>maven-assembly-plugin</artifactId>
  79. <version>3.0.0</version>
  80. <executions>
  81. <execution>
  82. <phase>package</phase>
  83. <goals>
  84. <goal>single</goal>
  85. </goals>
  86. </execution>
  87. </executions>
  88. <configuration>
  89. <descriptorRefs>
  90. <descriptorRef>jar-with-dependencies</descriptorRef>
  91. </descriptorRefs>
  92. </configuration>
  93. </plugin>
  94. <plugin>
  95. <!-- see http://davidb.github.com/scala-maven-plugin -->
  96. <groupId>net.alchim31.maven</groupId>
  97. <artifactId>scala-maven-plugin</artifactId>
  98. <version>3.2.2</version>
  99. <configuration>
  100. <scalaVersion>${scala.version}</scalaVersion>
  101. <scalaCompatVersion>${scala.compat.version}</scalaCompatVersion>
  102. </configuration>
  103. <executions>
  104. <execution>
  105. <phase>compile</phase>
  106. <goals>
  107. <goal>compile</goal>
  108. </goals>
  109. </execution>
  110. </executions>
  111. </plugin>
  112. <!-- for testing scala code -->
  113. <plugin>
  114. <groupId>org.apache.maven.plugins</groupId>
  115. <artifactId>maven-surefire-plugin</artifactId>
  116. <version>2.20</version>
  117. <configuration>
  118. <argLine>-Xmx2048m -XX:MaxPermSize=2048m</argLine>
  119. </configuration>
  120. </plugin>
  121. </plugins>
  122. </build>
  123. </project>
  124.  
  125. class test extends FunSuite with SharedSparkContext {
  126. test("test initializing spark context") {
  127. val list = List(1, 2, 3, 4)
  128. val rdd = sc.parallelize(list)
  129. val list2 = List(1, 2, 3, 4, 5)
  130.  
  131. assert(rdd.count === list2.length)
  132. }
  133. }
  134.  
  135. [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ mycode ---
  136. [INFO] Nothing to compile - all classes are up to date
  137. [INFO]
  138.  
  139. [INFO] --- maven-surefire-plugin:2.20:test (default-test) @ mycode ---
  140. [INFO]------------------------------------------------------------------------
  141. [INFO] BUILD SUCCESS
  142. [INFO]------------------------------------------------------------------------
  143.  
  144. <plugin>
  145. <groupId>org.apache.maven.plugins</groupId>
  146. <artifactId>maven-surefire-plugin</artifactId>
  147. <version>2.20</version>
  148. <configuration>
  149. <includes>
  150. <include>**/*Test.scala</include>
  151. </includes>
  152. <argLine>-Xmx2048m -XX:MaxPermSize=2048m</argLine>
  153. </configuration>
  154. </plugin>
  155.  
  156. <?xml version="1.0" encoding="UTF-8"?>
  157.  
  158. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  159. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  160. <modelVersion>4.0.0</modelVersion>
  161.  
  162. <groupId>com.test.spark</groupId>
  163. <artifactId>testJavaAndScala</artifactId>
  164. <version>1.0-SNAPSHOT</version>
  165. <name>Test for Java + Scala compilation</name>
  166. <description>Test for Java + Scala compilation</description>
  167. <inceptionYear>2017</inceptionYear>
  168.  
  169. <properties>
  170. <scala.version>2.11.5</scala.version>
  171. <scala.compat.version>2.11</scala.compat.version>
  172. <spark.version>1.6.1</spark.version>
  173. </properties>
  174.  
  175. <dependencies>
  176. <dependency>
  177. <groupId>org.scala-lang</groupId>
  178. <artifactId>scala-library</artifactId>
  179. <version>${scala.version}</version>
  180. </dependency>
  181. <!-- Spark dependency -->
  182. <dependency>
  183. <groupId>org.apache.spark</groupId>
  184. <artifactId>spark-core_${scala.compat.version}</artifactId>
  185. <version>${spark.version}</version>
  186. </dependency>
  187. <!-- Spark sql dependency -->
  188. <dependency>
  189. <groupId>org.apache.spark</groupId>
  190. <artifactId>spark-sql_${scala.compat.version}</artifactId>
  191. <version>${spark.version}</version>
  192. </dependency>
  193. <!-- Spark hive dependency -->
  194. <dependency>
  195. <groupId>org.apache.spark</groupId>
  196. <artifactId>spark-hive_${scala.compat.version}</artifactId>
  197. <version>${spark.version}</version>
  198. </dependency>
  199. <!-- Spark-testing-base -->
  200. <dependency>
  201. <groupId>com.holdenkarau</groupId>
  202. <artifactId>spark-testing-base_${scala.compat.version}</artifactId>
  203. <version>${spark.version}_0.6.0</version>
  204. <scope>test</scope>
  205. </dependency>
  206. </dependencies>
  207.  
  208. <build>
  209. <pluginManagement>
  210. <plugins>
  211. <plugin>
  212. <groupId>net.alchim31.maven</groupId>
  213. <artifactId>scala-maven-plugin</artifactId>
  214. <version>3.2.1</version>
  215. </plugin>
  216. <plugin>
  217. <groupId>org.apache.maven.plugins</groupId>
  218. <artifactId>maven-compiler-plugin</artifactId>
  219. <version>2.0.2</version>
  220. </plugin>
  221. </plugins>
  222. </pluginManagement>
  223. <plugins>
  224. <plugin>
  225. <groupId>net.alchim31.maven</groupId>
  226. <artifactId>scala-maven-plugin</artifactId>
  227. <executions>
  228. <execution>
  229. <id>scala-compile-first</id>
  230. <phase>process-resources</phase>
  231. <goals>
  232. <goal>add-source</goal>
  233. <goal>compile</goal>
  234. </goals>
  235. </execution>
  236. <execution>
  237. <id>scala-test-compile</id>
  238. <phase>process-test-resources</phase>
  239. <goals>
  240. <goal>testCompile</goal>
  241. </goals>
  242. </execution>
  243. </executions>
  244. </plugin>
  245. <plugin>
  246. <groupId>org.apache.maven.plugins</groupId>
  247. <artifactId>maven-compiler-plugin</artifactId>
  248. <executions>
  249. <execution>
  250. <phase>compile</phase>
  251. <goals>
  252. <goal>compile</goal>
  253. </goals>
  254. </execution>
  255. </executions>
  256. </plugin>
  257. </plugins>
  258. </build>
  259.  
  260. </project>
  261.  
  262. [INFO] Scanning for projects...
  263. [INFO]
  264. [INFO] ------------------------------------------------------------------------
  265. [INFO] Building Test for Java + Scala compilation 1.0-SNAPSHOT
  266. [INFO] ------------------------------------------------------------------------
  267. [INFO]
  268. [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ testJavaAndScala ---
  269. [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
  270. [INFO] skip non existing resourceDirectory /home/src/main/resources
  271. [INFO]
  272. [INFO] --- scala-maven-plugin:3.2.1:add-source (scala-compile-first) @ testJavaAndScala ---
  273. [INFO] Add Source directory: /home/src/main/scala
  274. [INFO] Add Test Source directory: /home/src/test/scala
  275. [INFO]
  276. [INFO] --- scala-maven-plugin:3.2.1:compile (scala-compile-first) @ testJavaAndScala ---
  277. [INFO] /home/src/main/scala:-1: info: compiling
  278. [INFO] Compiling 1 source files to /home/target/classes at 1497938635103
  279. [INFO] prepare-compile in 0 s
  280. [INFO] compile in 3 s
  281. [INFO]
  282. [INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ testJavaAndScala ---
  283. [INFO] Nothing to compile - all classes are up to date
  284. [INFO]
  285. [INFO] --- maven-compiler-plugin:2.0.2:compile (default) @ testJavaAndScala ---
  286. [INFO] Nothing to compile - all classes are up to date
  287. [INFO]
  288. [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ testJavaAndScala ---
  289. [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
  290. [INFO] Copying 0 resource
  291. [INFO]
  292. [INFO] --- scala-maven-plugin:3.2.1:testCompile (scala-test-compile) @ testJavaAndScala ---
  293. [INFO] /home/src/test/scala:-1: info: compiling
  294. [INFO] Compiling 1 source files to /home/target/test-classes at 1497938639022
  295. [INFO] prepare-compile in 0 s
  296. [INFO] compile in 5 s
  297. [INFO]
  298. [INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) @ testJavaAndScala ---
  299. [INFO] Nothing to compile - all classes are up to date
  300. [INFO]
  301. [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ testJavaAndScala ---
  302. [INFO] Surefire report directory: /home/target/surefire-reports
  303.  
  304. -------------------------------------------------------
  305. T E S T S
  306. -------------------------------------------------------
  307.  
  308. Results :
  309.  
  310. Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
  311.  
  312. [INFO] ------------------------------------------------------------------------
  313. [INFO] BUILD SUCCESS
  314. [INFO] ------------------------------------------------------------------------
  315. [INFO] Total time: 14.854 s
  316. [INFO] Finished at: 2017-06-20T08:04:05+02:00
  317. [INFO] Final Memory: 28M/360M
  318. [INFO] ------------------------------------------------------------------------
  319.  
  320. <!-- disable surefire -- >
  321. <plugin>
  322. <groupId>org.apache.maven.plugins</groupId>
  323. <artifactId>maven-surefire-plugin</artifactId>
  324. <version>2.7</version>
  325. <configuration>
  326. <skipTests>true</skipTests>
  327. </configuration>
  328. </plugin>
  329. <!-- enable scalatest -- >
  330. <plugin>
  331. <groupId>org.scalatest</groupId>
  332. <artifactId>scalatest-maven-plugin</artifactId>
  333. <version>1.0</version>
  334. <configuration>
  335. <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
  336. <junitxml>.</junitxml>
  337. <filereports>WDF TestSuite.txt</filereports>
  338. </configuration>
  339. <executions>
  340. <execution>
  341. <id>test</id>
  342. <goals>
  343. <goal>test</goal>
  344. </goals>
  345. </execution>
  346. </executions>
  347. </plugin>
  348.  
  349. src/main/scala/com/test/spark/mycode.scala
  350. src/main/test/com/test/spark/test.scala
  351.  
  352. src/main/scala/com/test/spark/mycode.scala
  353. src/test/scala/com/test/spark/test.scala
  354.  
  355. <execution>
  356. <id>scala-test-compile</id>
  357. <phase>process-test-resources</phase>
  358. <goals>
  359. <goal>testCompile</goal>
  360. </goals>
  361. </execution>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement