简体   繁体   English

为什么IntelliJ IDEA会抛出编译错误?

[英]Why does IntelliJ IDEA throw compilation error?

Compiling Spark gives this compile error : 编译Spark会产生以下编译错误:

在此输入图像描述

To fix I modify Utils.classIsLoadable method to just return true : 要修复我修改Utils.classIsLoadable方法只返回true

def classIsLoadable(clazz: String): Boolean = {
    // Try { Class.forName(clazz, false, getContextOrSparkClassLoader) }.isSuccess
    true
}

I realise this is not a good fix, but so far Spark seems to be running correctly from source. 我意识到这不是一个好的解决方案,但到目前为止Spark似乎从源代码正确运行。 Has this compile error been experienced before and is there a fix? 之前是否遇到过此编译错误,是否有修复? Will returning true suffice for now , I'm not sure what impact modifying this return value may have? 现在返回true就足够了,我不确定修改这个返回值会有什么影响?

I suggest compiling Spark from the command-line using Maven or SBT instead of trying to use your IDE's compiler. 我建议使用Maven或SBT从命令行编译Spark,而不是尝试使用IDE的编译器。 Many of the core Spark developers use IntelliJ for editing Spark's source code but still use the command-line compilers, largely because it's been difficult to get the project to build correctly inside IDEs. 许多核心Spark开发人员使用IntelliJ编辑Spark的源代码,但仍然使用命令行编译器,主要是因为很难让项目在IDE中正确构建。 Even if you're using an external compiler, you should still be able to benefit from IntelliJ's syntax highlighting, type checking, etc. 即使您使用外部编译器,您仍然可以从IntelliJ的语法突出显示,类型检查等中受益。

Here's a relevant discussion from the Spark developer mailing list: http://apache-spark-developers-list.1001551.n3.nabble.com/IntelliJ-IDEA-cannot-compile-TreeNode-scala-td7090.html 以下是Spark开发人员邮件列表中的相关讨论: http//apache-spark-developers-list.1001551.n3.nabble.com/IntelliJ-IDEA-cannot-compile-TreeNode-scala-td7090.html

Note that Spark users should be able to use IntelliJ to compile applications that depend on Spark; 请注意,Spark 用户应该能够使用IntelliJ来编译依赖于Spark的应用程序; this issue only affects developers who want to build Spark itself. 此问题仅影响想要构建Spark本身的开发人员。

If you're interested in fixing the build to work with IntelliJ, I recommend opening a ticket on the Spark issue tracker . 如果您有兴趣修复构建以使用IntelliJ,我建议在Spark问题跟踪器上打开一张票。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM