1. Eclipse開發環境搭建html
1.1. 安裝scala插件redis
安裝eclipse-scala-plugin插件,下載地址http://scala-ide.org/download/prev-stable.htmlsql
解壓縮之後把plugins和features複製到eclipse目錄,重啓eclipse之後便可。apache
Window -> Open Perspective -> Other…,打開Scala,說明安裝成功。eclipse
1.2. 建立maven工程maven
打開File -> New -> Other…,選擇Maven Project:ide
點擊Next,輸入項目存放路徑:ui
點擊Next,選擇org.scala-tools.archetypes:url
點擊Next,輸入artifact相關信息:spa
點擊Finish便可。默認建立好的工程目錄結構以下:
前面用的別人的截圖
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.dianru</groupId>
<artifactId>SparkSqlTest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demon-parent</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.10</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>net.debasishg</groupId>
<artifactId>redisclient_2.10</artifactId>
<version>3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<!-- execution元素包含了插件執行須要的信息 -->
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>