简体   繁体   English

使用早期版本的Scala运行Eclipse Scala插件

[英]Running Eclipse Scala Plugin with previous version of Scala

The scala plugin seems to automatically download version 2.8 of Scala. Scala插件似乎会自动下载2.8版的Scala。 I'l like to try out the Gridgain 3.0-beta , which currently only works with Scala 2.7.7. 我想尝试Gridgain 3.0-beta ,它目前仅适用于Scala 2.7.7。 Since Gridgain 3.0-beta already provides scala-compiler-2.7.7.jar and scala-library-2.7.7.jar, is it possible to get the Eclipse Scala Plugin to compile to Scala 2.7.7? 由于Gridgain 3.0-beta已经提供了scala-compiler-2.7.7.jar和scala-library-2.7.7.jar,是否有可能将Eclipse Scala插件编译为Scala 2.7.7?

I tried removing the Scala Library 2.8 from the project build path and added both the 2.7 jars, but this didn't seem to work. 我尝试从项目构建路径中删除Scala库2.8,并添加了这两个2.7 jar,但这似乎不起作用。

Would this be easier if I switched to Netbeans? 如果我改用Netbeans,这会更容易吗?

Both the Eclipse plugin and the NetBeans plugin use the Scala Compiler for a lot of things from the simple stuff like syntax highlighting to stuff like type inference, resolution and display of implicits to more involved stuff like automated type-driven refactorings and semantic highlighting. Eclipse插件和NetBeans插件都使用Scala编译器来完成许多事情,从简单的东西(例如语法突出显示)到类型推断,解析和隐式显示之类的东西,再到更复杂的东西,例如自动类型驱动的重构和语义突出显示。

And more specifically, they use the 2.8 compiler, because the 2.8 compiler has a completely refactored API and a new framework (the so-called presentation compiler ), which is specifically designed for IDEs, so that they can get all the information they need out of the compiler, but also can feed information (like in the case of refactorings) back into the compiler. 更具体地说,他们使用的2.8编译器,因为2.8编译器具有完全重构的API和一个新的框架(即所谓的演示编译器 ),这是专门为集成开发环境设计的,使他们能够得到他们需要走出的所有信息编译器的,而且还可以将信息反馈(如在重构的情况下)返回编译器。

So, in short: the version of the plugin is closely coupled to the version of the compiler, and the compiler in turn only supports one version of the language. 简而言之:插件的版本与编译器的版本紧密相关,而编译器仅支持一种语言版本。 In particular, the IDE plugins require a 2.8 version of the compiler, because they use the new presentation compiler framework, and the 2.8 compiler does not support the 2.7 language. 特别是,IDE插件需要使用2.8版本的编译器,因为它们使用了新的演示文稿编译器框架,并且2.8编译器不支持2.7语言。

This tight coupling is of course not a good thing, and it will get broken up in the future, but for now, you are stuck. 这种紧密的耦合当然不是一件好事,将来会被打破,但就目前而言,您仍然陷于困境。

You could try the IntelliJ IDEA IDE and their Scala plugin. 可以尝试IntelliJ IDEA IDE及其Scala插件。 As far as I know, they have written their own compiler (well, at least the parts they need for syntax highlighting and refactoring purposes) purely from the Scala Language Specification, without using any of the Scala Compiler APIs. 据我所知,他们完全是根据Scala语言规范编写了自己的编译器(至少是语法突出显示和重构所需的部分),而没有使用任何Scala编译器API。 The Scala Plugin does work with the Community Edition. Scala插件可以与Community Edition一起使用。

The best place for questions like this is the Scala IDE user mailing list . 出现此类问题的最佳地点是Scala IDE用户邮件列表 But in brief, the Eclipse tooling for Scala doesn't support the use of other versions of the Scala compiler and libraries than the ones which it ships with. 但简单来说,用于Scala的Eclipse工具不支持使用与其附带的其他版本的Scala编译器和库。 This is unlikely to change in the foreseeable future. 在可预见的将来,这种情况不太可能改变。

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

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