如何创建 Intellij 和 Eclipse 兼容的代码风格和代码格式配置(针对 java 代码)?

发布于 2024-08-28 04:37:45 字数 399 浏览 5 评论 0原文

几周前,我尝试了 Intellij,发现它真的很棒。现在,在我的项目中,有两名程序员(包括我)使用 Intellij,而其他程序员则很少会继续使用 Eclipse。由于这个项目已经非常大并且将会增长很多,我们需要在 Intellij 和 Eclipse 之间使用兼容的代码风格和代码格式。我们不希望当一个用户编辑某个文件并在保存之前重新格式化它时出现问题。 “单独”使用 Eclipse,我们曾经有一些导出的配置,在任何人开始工作之前,第一步就是导入此配置。我们已经尝试过使用外部代码格式化程序,但它在 Intellij 9 上不起作用。

所以,我这里有很多问题:

  1. 有没有办法在 Intellij 9 上导入 eclipse 格式化配置?
  2. 有人可以分享处理这种情况的经验吗?你们还有其他建议来处理这种情况吗?

Few weeks ago I tried Intellij and I found it really awesome. Now, at my project there are two programmers (including me) using Intellij and few other programmers who are going to keep using Eclipse. Since this project is already very large and it's going to grow a lot, we need to use compatible Code Style and Code Formatting between Intellij and Eclipse. We do not want to have problems when one user edits some file and reformats it before saving. With Eclipse "alone" we used to have some exported configuration, and before anybody starts to work, the first step is just to import this configuration. We already tried to use External Code Formatter, but it didn't work on Intellij 9.

So, I have a bunch of questions here:

  1. Is there any way to import eclipse formatting configuration on Intellij 9?
  2. Anybody could share their experience managing this kind of situation? Do you guys have any other suggestion to manage this situation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

む无字情书 2024-09-04 04:37:45

IDEA 有一个更新的插件,称为 Eclipse Code Formatter:
http://plugins.intellij.net/plugin/?idea&id=6546

There is an updated plugin for IDEA, called Eclipse Code Formatter:
http://plugins.intellij.net/plugin/?idea&id=6546

千寻… 2024-09-04 04:37:45

我建议有人花时间将 IntelliJ 的代码风格配置为与 Eclipse 相同。这将花费一些时间和精力,但一旦完成,您可以像在 Eclipse 中一样导出它,以便任何其他 IDEA 用户可以导入它。

您还可以在线搜索,看看是否有人已经这样做了,您可以简单地下载代码样式配置并使用它。

我能想到的唯一选择是找到一个可用于 eclipse 和 IntelliJ 的标准化代码样式模板,例如推荐的 Sun Java 代码样式。

I would recommend someone spends the time to configure their IntelliJ's code style to be the same as Eclipse. This will take a little time and effort but once it is done, you can export it just like in eclipse so that any other IDEA users can import it.

You could also search online to see if anyone has already done this and you can simply download the code style config and use it.

The only alternative I can think of would be to find a standardized code style template that is available for both eclipse and IntelliJ, like the Recommended Sun Java Code Style.

不可一世的女人 2024-09-04 04:37:45

似乎有一个插件(来自此讨论)。

There seems to be a plugin for that (emerged from this discussion).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文