1.导入响应的依赖
###pom.xml文件对应一下配置,一定要注意spark系列版本要一致,否则导入了包,依然说找不到
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.11</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-graphx_2.11</artifactId>
<version>${spark.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_2.11</artifactId>
<version>${spark.version}</version>
</dependency>
###传入集群上的配置文件
###scala中代码中要加入hive支持
val spark: SparkSession = SparkSession.builder()
.appName(this.getClass.getSimpleName)
.master("local")
.enableHiveSupport().getOrCreate()