我听说有人选择了其中一种方式,并对其中一种方式发誓。
作为一个Eclipse的忠实粉丝,但没有时间尝试IntelliJ,我很有兴趣从“前Eclipse用户”IntelliJ用户那里听到一些用IntelliJ可以做而用Eclipse不能做的具体事情。
注意:这不是一个主观的问题,也不意味着变成一场IDE圣战。请为任何煽动性的答案投票。
我听说有人选择了其中一种方式,并对其中一种方式发誓。
作为一个Eclipse的忠实粉丝,但没有时间尝试IntelliJ,我很有兴趣从“前Eclipse用户”IntelliJ用户那里听到一些用IntelliJ可以做而用Eclipse不能做的具体事情。
注意:这不是一个主观的问题,也不意味着变成一场IDE圣战。请为任何煽动性的答案投票。
当前回答
对我来说,它是IDEA的maven支持,特别是在版本9中是首屈一指的。项目与maven模型的动态同步非常棒,使开发变得愉快。
其他回答
我最近发现IntelliJ IDEA与Eclipse相比至少有两个优点。
如果试图在JSP代码编辑器中使用代码格式化,JSP脚本就会出错。Eclipse变得有点疯狂,它到处发布随机的代码片段。IDEA表现得很好。
另一件事是在JBoss服务器上部署应用程序的速度。IntelliJ正在替换JBoss tmp文件夹中的应用程序,因此重新部署非常快。Eclipse WTP正在替换deploy文件夹中的应用程序,而后者的持续时间要长得多。
一个非常有用的特性是能够部分构建Maven反应堆项目,以便只包括您需要的部分。
To make this a little clearer, consider the case of a collection of WAR files with a lot of common resources (e.g. JavaScript, Spring config files etc) being shared between them using the overlay technique. If you are working on some web page (running in Jetty) and want to change some of the overlay code that is held in a separate module then you'd normally expect to have to stop Jetty, run the Maven build, start Jetty again and continue. This is the case with Eclipse and just about every other IDE I've worked with. Not so in IntelliJ. Using the project settings you can define which facet of which module you would like to be included in a background build. Consequently you end up with a process that appears seamless. You make a change to pretty much any code in the project and instantly it is available after you refresh the browser.
非常简洁,而且非常快。
我无法想象在没有它的情况下,在像YUI这样的东西中编写一个返回到DWR/SpringMVC的前端。
CTRL-click在任何地方都适用
CTRL-click that brings you to where clicked object is defined works everywhere - not only in Java classes and variables in Java code, but in Spring configuration (you can click on class name, or property, or bean name), in Hibernate (you can click on property name or class, or included resource), you can navigate within one click from Java class to where it is used as Spring or Hibernate bean; clicking on included JSP or JSTL tag also works, ctrl-click on JavaScript variable or function brings you to the place it is defined or shows a menu if there are more than one place, including other .js files and JS code in HTML or JSP files.
自动完成许多语言
Hibernate
在HSQL表达式、Hibernate配置(包括类、属性和DB列名)、Spring配置中自动完成
<property name="propName" ref="<hit CTRL-SPACE>"
它会显示你可以注入到属性中的bean列表。
Java
Java代码中非常智能的自动完成:
interface Person {
String getName();
String getAddress();
int getAge();
}
//---
Person p;
String name = p.<CTRL-SHIFT-SPACE>
它显示你只有getName(), getAddress()和toString()(只有他们是类型兼容)和getName()是第一个在列表中,因为它有更多相关的名称。EAP的最新版本8拥有更智能的自动补全功能。
interface Country{
}
interface Address {
String getStreetAddress();
String getZipCode();
Country getCountry();
}
interface Person {
String getName();
Address getAddress();
int getAge();
}
//---
Person p;
Country c = p.<CTRL-SHIFT-SPACE>
它会自动完成到
Country c = p.getAddress().getCountry();
Javascript
JavaScript中的智能自动完成。
function Person(name,address) {
this.getName = function() { return name };
this.getAddress = function() { return address };
}
Person.prototype.hello = function() {
return "I'm " + this.getName() + " from " + this.get<CTRL-SPACE>;
}
并且它只显示getName()和getAddress(),不管你在你的项目中的其他JS对象中如何使用get*方法,ctrl-click this.getName()将带你到这个定义的地方,即使在你的项目中有一些其他的getName()函数。
HTML
我提到过自动完成和按ctrl键点击文件路径,比如<script src="", <img src="",等等?
自动完成HTML标签属性。自动完成HTML标签的样式属性,包括属性名和值。在类属性中也可以自动完成。 输入<div class="<CTRL-SPACE>,它将显示您在项目中定义的CSS类列表。选择一个,按ctrl键单击它,您将被重定向到它定义的位置。
轻松凸显自己的语言
最新版本有语言注入,所以你可以声明你自定义的JSTL标签通常包含JavaScript,它会突出显示其中的JavaScript。
<ui:obfuscateJavaScript>function something(){...}</ui:obfuscateJavaScript>
跨所有项目的索引搜索。
You can use Find Usages of any Java class or method and it will find where it is used including not only Java classes but Hibernate, Spring, JSP and other places. Rename Method refactoring renames method not only in Java classes but anywhere including comments (it can not be sure if string in comments is really method name so it will ask). And it will find only your method even if there are methods of another class with same name. Good source control integration (does SVN support changelists? IDEA support them for every source control), ability to create a patch with your changes so you can send your changes to other team member without committing them.
改进的调试器
当我在调试器的监视窗口中查看HashMap时,我看到逻辑视图-键和值,上次我在Eclipse中做了它,它显示了带有哈希和下一个字段的条目-我不是真正调试HashMap,我只是想看看它的内容。
Spring和Hibernate配置验证
它在编辑时验证Spring和Hibernate配置,所以我不需要重新启动服务器来知道我拼错了类名,或者添加了构造函数参数,所以我的Spring cfg无效。
上次尝试时,我无法在Windows XP x64上运行Eclipse。
它会提示你person。name或person。address。 Ctrl-click Person .name,它将导航到Person类的getName()方法。
类型Pattern.compile (" ");输入\\在那里,点击CTRL-SPACE,看看你可以在正则表达式中输入什么的有用提示。你也可以在这里使用语言注入——定义你自己的接受字符串参数的方法,在IntelliLang选项对话框中声明你的参数是正则表达式——它也会给你自动补全。不用说,它突出了不正确的正则表达式。
其他功能
有几个特性我不确定Eclipse中是否存在。但是至少我们团队中使用Eclipse的每个成员,也使用一些合并工具来合并本地更改和来自源代码控制的更改,通常是WinMerge。我从来不需要它——合并到IDEA对我来说就足够了。通过3次点击,我可以看到源代码控制中的文件版本列表,通过3次点击,我可以比较以前的版本,或者以前和当前的版本,并可能合并。
它允许指定我需要WEB-INF\lib文件夹中的所有。jar文件,而不单独选择每个文件,因此当有人提交新的。jar文件到该文件夹时,它会自动选择它。
上面提到的可能是它所做的10%。我不使用Maven、Flex、Swing、EJB和其他很多东西,所以我不知道它对它们有什么帮助。但确实如此。
从Maven POM打开一个项目。 只需选择“打开项目…”导航到你的顶级pom.xml,并按Enter:) NetBeans现在也有这个特性。
我经常使用的一件事是设置断点,然后控制它的功能。(在我的上一份工作中,大多数人都使用Eclipse……我记得我很惊讶,没有人能在Eclipse中找到如何做到这一点。)
例如,可以让断点实际上不停止,而只是将消息记录到控制台。这意味着,我不必用“System.out.println(…)”乱写代码,然后重新编译。