当前位置:  开发笔记 > 编程语言 > 正文

使用不兼容的Scala版本(2.10.0)交叉编译spark构建路径

如何解决《使用不兼容的Scala版本(2.10.0)交叉编译spark构建路径》经验,为你挑选了2个好方法。

当我尝试在scala IDE中执行sparksql代码时,我得到以下错误,有人可以帮我解决这个问题吗?

spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
akka-remote_2.10-2.3.11.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
akka-slf4j_2.10-2.3.11.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
breeze_2.10-0.11.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
breeze-macros_2.10-0.11.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.    spark       Unknown Scala Version Problem
chill_2.10-0.5.0.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
jackson-module-scala_2.10-2.4.4.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
json4s-ast_2.10-3.2.10.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
json4s-core_2.10-3.2.10.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
json4s-jackson_2.10-3.2.10.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
quasiquotes_2.10-2.0.1.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
scalatest_2.10-2.2.5.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
spark-catalyst_2.10-1.4.0.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.    spark       Unknown Scala Version Problem
spark-core_2.10-1.5.2-tests.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
spark-core_2.10-1.5.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.    spark       Unknown Scala Version Problem
spark-graphx_2.10-1.4.0.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
spark-launcher_2.10-1.5.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.    spark       Unknown Scala Version Problem
spark-mllib_2.10-1.4.0-tests.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
spark-mllib_2.10-1.4.0.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
spark-network-common_2.10-1.5.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
spark-network-shuffle_2.10-1.5.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
spark-sql_2.10-1.4.0.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
spark-streaming_2.10-1.5.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
spark-unsafe_2.10-1.5.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
spire_2.10-0.7.4.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
spire-macros_2.10-0.7.4.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
The version of scala library found in the build path of spark (2.10.4) is prior to the one provided by scala IDE (2.11.7). Setting a Scala Installation Choice to match.    spark       Unknown Scala Version Problem

Donato Piroz.. 33

在您的项目中,您使用的是使用不同Scala版本构建的jar; 确实来自日志:

Scala IDE使用Scala 2.11.7

使用Scala 2.10构建的Apache Spark 1.5.2

您需要对齐罐子版本.实际上Spark 1.5.2预构建(可从这里下载)由于兼容性原因而使用Scala 2.10构建(参见此处).在网站上有一个注释:

注意:Scala 2.11用户应下载Spark源包并使用Scala 2.11支持构建.

为了解决这个问题,在您的项目中使用与构建Spark相同的Scala版本.

我建议尝试在Scala IDE中切换到Scala 2.10,它将解决问题.

Eclipse + Maven

在我的例子中,我使用Eclipse与Scala IDE和Maven,所以我以这种方式更新了Maven依赖项:


    org.scala-lang
    scala-library
    2.10.6


    org.apache.spark
    spark-core_2.10
    1.5.2

然后,我在IDE中更改了Scala版本:右键单击项目 - > Scala - >设置Scala安装右键单击Scala Library Container - > Properties并选择Scala 2.10,如下所示

在Eclipse IDE中更改Scala版本



1> Donato Piroz..:

在您的项目中,您使用的是使用不同Scala版本构建的jar; 确实来自日志:

Scala IDE使用Scala 2.11.7

使用Scala 2.10构建的Apache Spark 1.5.2

您需要对齐罐子版本.实际上Spark 1.5.2预构建(可从这里下载)由于兼容性原因而使用Scala 2.10构建(参见此处).在网站上有一个注释:

注意:Scala 2.11用户应下载Spark源包并使用Scala 2.11支持构建.

为了解决这个问题,在您的项目中使用与构建Spark相同的Scala版本.

我建议尝试在Scala IDE中切换到Scala 2.10,它将解决问题.

Eclipse + Maven

在我的例子中,我使用Eclipse与Scala IDE和Maven,所以我以这种方式更新了Maven依赖项:


    org.scala-lang
    scala-library
    2.10.6


    org.apache.spark
    spark-core_2.10
    1.5.2

然后,我在IDE中更改了Scala版本:右键单击项目 - > Scala - >设置Scala安装右键单击Scala Library Container - > Properties并选择Scala 2.10,如下所示

在Eclipse IDE中更改Scala版本



2> 小智..:

在项目上单击右键,然后选择" 属性".选择Scala编译器 单击"使用项目设置"选择Scala安装选择您的scala版本,例如,2.11.11.

推荐阅读
殉情放开那只小兔子
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有