Emacs java 模式:malabar、jdee 还是 eclim?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4654725/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 07:22:52  来源:igfitidea点击:

Emacs java-mode: malabar, jdee, or eclim?

javaemacs

提问by avendael

I want to use emacs for java coding, but I'm confused on what mode to use for java coding. There's jdee, which seems ide-like; malabar, who is said to be more well versed in java 1.5 constructs than jdee; and emacs-eclim, which is an eclipse backend for emacs. There are also a wealth of completion extensions for emacs, and I'm also confused on which one to use. In fact, I'm so confused that I deferred using any of them until I get recommendations.

我想使用 emacs 进行 java 编码,但我对 java 编码使用什么模式感到困惑。有 jdee,它看起来像 ide;malabar,据说他比 jdee 更精通 java 1.5 结构;和 emacs-eclim,它是 emacs 的 eclipse 后端。emacs 的补全扩展也很丰富,我也很迷茫该用哪个。事实上,我很困惑,以至于我推迟了使用它们中的任何一个,直到我得到建议。

What is the current best option for java-mode + completion in emacs? And, if ever I decide to use a combination of what I mentioned above, will conflicts happen?

emacs 中 java-mode + 完成的当前最佳选择是什么?而且,如果我决定使用我上面提到的组合,会发生冲突吗?

采纳答案by Glenn

For those used to the power of Emacs text manipulation then Eclipse can seem like pedaling a bicycle with one foot. The Emacs+ plugin from http://www.mulgasoft.com/is excellent for getting Emacs key bindings into Eclipse.

对于那些习惯了 Emacs 文本操作功能的人来说,Eclipse 就像用一只脚踩自行车一样。来自http://www.mulgasoft.com/的 Emacs+ 插件非常适合将 Emacs 键绑定导入 Eclipse。

I use both Eclipse and Emacs a lot, but if I only did Java development I might use only Eclipse with Emacs+. It takes some work to get many Eclipse features enabled on Emacs.

我经常使用 Eclipse 和 Emacs,但如果我只做 Java 开发,我可能只使用带有 Emacs+ 的 Eclipse。在 Emacs 上启用许多 Eclipse 功能需要一些工作。

My advice is to use Emacs >= 23. If you are on a Mac, look at AquaMacs. I use JDEE as the Java plugin. This has the serious drawback of not playing well with generics. It's not that it stops working, it's just that a lot of stuff isn't recognized. Do not use the old 2.3.5 JDEE plugin (that comes with most Linux distributions), but get the 2.4 version from the sourceforgesite. Also get the Emacs Code Browser(ECB); this is a plugin that will give you stuff like Eclipse's Project Explorer and Outline views (other developers will look at this and not believe you when tell them that it's Emacs). I've used this setup for commercial projects on Windows, Mac, and Linux in the past year.

我的建议是使用 Emacs >= 23。如果您使用的是 Mac,请查看AquaMacs。我使用 JDEE 作为 Java 插件。这有一个严重的缺点,那就是不能很好地使用泛型。不是它停止工作,只是很多东西没有被识别。不要使用旧的 2.3.5 JDEE 插件(大多数 Linux 发行版附带),而是从sourceforge站点获取 2.4 版本。同时获取Emacs 代码浏览器(ECB);这是一个插件,可以为您提供诸如 Eclipse 的项目资源管理器和大纲视图之类的东西(其他开发人员会看到这个,并且在告诉他们它是 Emacs 时不会相信您)。去年,我在 Windows、Mac 和 Linux 上将此设置用于商业项目。

In fact, Eclipse plays pretty well with Emacs and I often switch between the two. Eclipse has some nice refactoring tools that I used to use sed for, and it has a good debugger interface. You can use them simultaneously. I find that I use Eclipse when working with other people's code and Emacs when I am writing my own code---Emacs is that much faster. Note that for me, a lot of the value of Emacs is the non-Java functionality, like editing Tomcat configuration files on remote servers from my local Emacs, writing professional documents with LaTeX, developing in Python or Bash or MATLAB or XML, and the odd text manipulation task (e.g., converting CVS files into String[] arrays).

事实上,Eclipse 与 Emacs 配合得很好,我经常在两者之间切换。Eclipse 有一些很好的重构工具,我过去常常使用 sed 来实现这些工具,并且它有一个很好的调试器界面。您可以同时使用它们。我发现我在处理其他人的代码时使用 Eclipse,而在编写自己的代码时使用 Emacs --- Emacs 快得多。请注意,对我而言,Emacs 的很多价值在于非 Java 功能,例如从本地 Emacs 编辑远程服务器上的 Tomcat 配置文件、使用 LaTeX 编写专业文档、使用 Python 或 Bash、MATLAB 或 XML 进行开发,以及奇怪的文本操作任务(例如,将 CVS 文件转换为 String[] 数组)。

I haven't used the other two projects you mention. It is possible to use the Eclipse compiler with Emacs already, so I'm not sure I see the point of the emacs-eclim project, which seems to be moribund anyway. The Malabar project might be interesting, but seems to be the product of one somewhat cranky developer (e.g., the warning"if you're not using Maven (why?) you should not consider malabar-mode"---I'll tell my clients that?).

你说的另外两个项目我没用过。已经可以将 Eclipse 编译器与 Emacs 一起使用,所以我不确定我是否看到了 emacs-eclim 项目的意义,无论如何它似乎已经奄奄一息。Malabar 项目可能很有趣,但似乎是一个有点古怪的开发人员的产品(例如,警告“如果你不使用 Maven(为什么?)你不应该考虑 Malabar-mode”---我会告诉你我的客户呢?)。

Java on Emacs is in a sad state. I wish for JDEE to be revitalized, but it's not clear when or if that will happen. The web site and mailing list offer few clues.

Emacs 上的 Java 处于可悲的状态。我希望 JDEE 能够重振旗鼓,但尚不清楚何时或是否会发生。网站和邮件列表提供的线索很少。

回答by fred-o

I use emacs-eclim with auto-complete-mode support and java-mode highlighting exclusively for Java programming. 90% of my work is done in emacs, but I switch to eclipse when I need to debug, run unit tests or do major refactorings. All in all, this setup works very well for me.

我将 emacs-eclim 与自动完成模式支持和 java 模式突出显示专用于 Java 编程。我 90% 的工作都是在 emacs 中完成的,但是当我需要调试、运行单元测试或进行重大重构时,我会切换到 eclipse。总而言之,这个设置对我来说非常有效。

I haven't tried JDEE for years, but I remember it was a b*tch to set up. I didn't care for the UI very much, as it put up lots of prearranged windows that were locked in place. I like to be able to switch back and forth between editing buffers, often showing just one window, but splitting and rearranging on the fly when it becomes necessary.

我已经很多年没有尝试过 JDEE,但我记得设置起来很麻烦。我不太关心用户界面,因为它提供了许多锁定到位的预先安排的窗口。我喜欢能够在编辑缓冲区之间来回切换,通常只显示一个窗口,但在必要时可以即时拆分和重新排列。

Note: I am an emacs-eclim maintainer, and this has probably coloured my judgement.

注意:我是 emacs-eclim 的维护者,这可能影响了我的判断。

回答by skybert

If you're using Maven, then I'd recommend malabar-mode. It will set everything up for you automagically, no need for editing project files like you'd have to do with JDEE. The downside I've found with malabar, is that it can consume a lot of memory if you've got a lot of multi level module projects open.

如果您使用的是 Maven,那么我建议您使用 malabar-mode。它会自动为您设置一切,无需像使用 JDEE 那样编辑项目文件。我发现 malabar 的缺点是,如果您打开了许多多级模块项目,它会消耗大量内存。

Both Malabar and JDEE will give you "true" completion, i.e. only completions that are possible. However, there are two amazing "intelligent guessing completion frameworks" in Emacs. hippie-expand and auto-complete.

Malabar 和 JDEE 都会给你“真正的”补全,即只有可能的补全。但是,Emacs 中有两个惊人的“智能猜测补全框架”。嬉皮扩展和自动完成。

The former is great (can complete whole code blocks for you, making it possible to e.g. cycle through all if-tests in your projects), but auto-complete modeis even better. It'll give you a nice intelli sense style menu, will "learn" as you use it, and allows you to define a file with the completions you'd like to be available in the various languages.

前者很棒(可以为您完成整个代码块,例如可以循环浏览项目中的所有 if 测试),但自动完成模式甚至更好。它会给你一个很好的智能风格菜单,在你使用它时会“学习”,并允许你定义一个文件,你希望在各种语言中可用。