我已经在Ubuntu 14.04 LTS上安装了Spark 1.5。当使用命令build/mvn -Dscala-2.11 -DskipTests clean package
运行构建时,我在Spark SQL项目期间得到以下构建错误:
[error] missing or invalid dependency detected while loading class file 'WebUI.class'.
[error] Could not access term eclipse in package org,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'WebUI.class' was compiled against an incompatible version of org.
[error] missing or invalid dependency detected while loading class file 'WebUI.class'.
[error] Could not access term jetty in value org.eclipse,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'WebUI.class' was compiled against an incompatible version of org.eclipse.
[warn] 22 warnings found
[error] two errors found
[error] Compile failed at Sep 18, 2015 6:09:38 PM [17.330s]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Spark Project Parent POM ........................... SUCCESS [ 6.723 s]
[INFO] Spark Project Core ................................. SUCCESS [03:07 min]
...
[INFO] Spark Project Catalyst ............................. SUCCESS [ 58.166 s]
[INFO] Spark Project SQL .................................. FAILURE [ 19.912 s]
[INFO] Spark Project Hive ................................. SKIPPED
[INFO] Spark Project Unsafe ............................... SKIPPED
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
下面是我的环境变量文件.bashrc
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
export SCALA_HOME=/usr/local/src/scala/scala-2.11.7
export PATH=$SCALA_HOME/bin:$PATH
export PATH=/home/ubuntu/apache-maven-3.3.3/bin:$PATH
export SPARK_HOME=/home/ubuntu/spark-1.5.0
export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512m"
更新:尝试使用-Ylog-classpath运行,但不工作:
Unable to parse command line options: Unrecognized option: -Ylog-classpath
从spark目录中运行./dev/change-scala-version.sh 2.11
,将所有代码切换到2.11。然后运行mvn
(3.3.3+)或make-distribution.sh
与您的标志设置。
参考Angelo Genovese的评论,不要在构建命令中包含-Dscala-2.11
如果你不是特别需要spark-sql,那么就从构建中排除sql相关的模块:
mvn clean package -Dscala-2.11 -DskipTests -pl '!sql/core,!sql/catalyst,!sql/hive'
我也遇到了这个问题,在一个我从Maven pom.xml
导入IntelliJ的项目中。我的同事帮我弄清楚,虽然<scope>runtime</scope>
对大多数依赖都是可以的,但这个特殊的依赖需要是<scope>compile</scope>
(原因我们不明白):
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-reflect</artifactId>
<version>${scala.version}</version>
<scope>compile</scope>
</dependency>
这个构建问题可以首先通过运行位于@ spark-1.6.1/dev/change-scala-version.sh 2.11的'change-scala-version.sh'命令将scala版本从2.10更改为2.11来解决
详细信息请参考下面的链接。http://gibbons.org.uk/spark - 2月- windows - 2016