1、创建maven scala项目
2、maven配置
<properties> <scala.version>2.11.8</scala.version> <spark.version>2.3.1</spark.version> </properties> <dependencies> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>${scala.version}</version> </dependency> <dependency> <groupId>org.apache.spark</groupId> <artifactId>spark-core_2.11</artifactId> <version>${spark.version}</version> </dependency> <dependency> <groupId>org.apache.spark</groupId> <artifactId>spark-mllib_2.11</artifactId> <version>${spark.version}</version> </dependency> <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-hive_2.11</artifactId> <version>${spark.version}</version> </dependency> </dependencies>
2、删除默认创建的类,剩下如图
修改main和test为source
注意 main和test的颜色发生了变化
3、创建scala类
然后再建立scala类,
ok
Kind选择Object
4、配置,运行
成功运行,这样第一个scala程序创建成功