mvn编译程序出错

来源:5-2 -A SQLContext的使用

maomaoking

2018-10-13

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()

}

}

写回答

2回答

Michael_PK

2018-10-13

先错误一解决下,把代码都删了

0
3
maomaoking
回复
Michael_PK
这个问题解决了,pom文档里面有行没有注释掉,导致前后,报错!!!
2018-10-13
共3条回复

Michael_PK

2018-10-13

先不要代码,先保证空的工程能正确编译先

0
0

以慕课网日志分析为例 进入大数据Spark SQL的世界

快速转型大数据:Hadoop,Hive,SparkSQL步步为赢

1644 学习 · 1129 问题

查看课程