mac 系统 将程序用maven 命令 出错:
错误一:
/Users/liujingmao/IdeaProjects/sql/src/main/scala/com/mao/sparksql/SparkSqlContext.scala:28: error: Reference to class SQLContext in package sql should not have survived past type checking,
[INFO] it should have been processed and eliminated during expansion of an enclosing macro.
[INFO] val sqlContext = new SQLContext(sc)
[INFO] ^
错误二:
Failed to execute goal org.scala-tools:maven-scala-plugin:2.15.0:compile (default) on project sql: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1(Exit value: 1) -> [Help 1]
源代码:
package com.mao.sparksql
import org.apache.spark.sql.SQLContext
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
/**
*
*/
object SparkSqlContext {
def main(args: Array[String]): Unit = {
val path = args(0)
//Create sparkConf
val sparkConf = new SparkConf()
sparkConf.setAppName("SQLContextApp").setMaster("local[2]")
//创建SparkContext
val sc = new SparkContext(sparkConf)
//创建相应的Context
val sqlContext = new SQLContext(sc)
//处理相关的业务
val people = sqlContext.read.format("json").load(path)
people.printSchema()
people.show()
sc.stop()
}
}